Skip to content

Commit 388c03b

Browse files
committed
Merge branch 'master' into sh_merge_master_clean
2 parents 2675884 + 1bbaeb3 commit 388c03b

29 files changed

+281
-132
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
python: '3.6'
4646
args: >
4747
-DPYBIND11_FINDPYTHON=ON
48+
-DCMAKE_CXX_FLAGS="-D_=1"
4849
- runs-on: windows-latest
4950
python: '3.6'
5051
args: >
@@ -69,7 +70,8 @@ jobs:
6970
python-version: ${{ matrix.python }}
7071

7172
- name: Setup Boost (Linux)
72-
if: runner.os == 'Linux'
73+
# Can't use boost + define _
74+
if: runner.os == 'Linux' && matrix.python != '3.6'
7375
run: sudo apt-get install libboost-dev
7476

7577
- name: Setup Boost (macOS)
@@ -248,6 +250,8 @@ jobs:
248250
python -m pip install -r tests/requirements.txt
249251
250252
- name: Configure
253+
env:
254+
SETUPTOOLS_USE_DISTUTILS: stdlib
251255
run: >
252256
cmake -S . -B build
253257
-DCMAKE_BUILD_TYPE=Debug
@@ -556,37 +560,37 @@ jobs:
556560
set +e; source /opt/intel/oneapi/setvars.sh; set -e
557561
cmake --build build-11 --target test_cmake_build
558562
559-
- name: Configure C++17
563+
- name: Configure C++14
560564
run: |
561565
set +e; source /opt/intel/oneapi/setvars.sh; set -e
562-
cmake -S . -B build-17 \
566+
cmake -S . -B build-14 \
563567
-DPYBIND11_WERROR=ON \
564568
-DDOWNLOAD_CATCH=ON \
565569
-DDOWNLOAD_EIGEN=OFF \
566-
-DCMAKE_CXX_STANDARD=17 \
570+
-DCMAKE_CXX_STANDARD=14 \
567571
-DCMAKE_CXX_COMPILER=$(which icpc) \
568572
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
569573
570-
- name: Build C++17
574+
- name: Build C++14
571575
run: |
572576
set +e; source /opt/intel/oneapi/setvars.sh; set -e
573-
cmake --build build-17 -j 2 -v
577+
cmake --build build-14 -j 2 -v
574578
575-
- name: Python tests C++17
579+
- name: Python tests C++14
576580
run: |
577581
set +e; source /opt/intel/oneapi/setvars.sh; set -e
578582
sudo service apport stop
579-
cmake --build build-17 --target check
583+
cmake --build build-14 --target check
580584
581-
- name: C++ tests C++17
585+
- name: C++ tests C++14
582586
run: |
583587
set +e; source /opt/intel/oneapi/setvars.sh; set -e
584-
cmake --build build-17 --target cpptest
588+
cmake --build build-14 --target cpptest
585589
586-
- name: Interface test C++17
590+
- name: Interface test C++14
587591
run: |
588592
set +e; source /opt/intel/oneapi/setvars.sh; set -e
589-
cmake --build build-17 --target test_cmake_build
593+
cmake --build build-14 --target test_cmake_build
590594
591595
592596
# Testing on CentOS (manylinux uses a centos base, and this is an easy way

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
repos:
1616
# Standard hooks
1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v4.0.1
18+
rev: v4.1.0
1919
hooks:
2020
- id: check-added-large-files
2121
- id: check-case-conflict
@@ -45,7 +45,7 @@ repos:
4545

4646
# Black, the code formatter, natively supports pre-commit
4747
- repo: https://github.com/psf/black
48-
rev: 21.11b1 # Keep in sync with blacken-docs
48+
rev: 21.12b0 # Keep in sync with blacken-docs
4949
hooks:
5050
- id: black
5151

@@ -54,7 +54,7 @@ repos:
5454
hooks:
5555
- id: blacken-docs
5656
additional_dependencies:
57-
- black==21.11b1 # keep in sync with black hook
57+
- black==21.12b0 # keep in sync with black hook
5858

5959
# Changes tabs to spaces
6060
- repo: https://github.com/Lucas-C/pre-commit-hooks
@@ -106,7 +106,7 @@ repos:
106106

107107
# Check static types with mypy
108108
- repo: https://github.com/pre-commit/mirrors-mypy
109-
rev: v0.910-1
109+
rev: v0.930
110110
hooks:
111111
- id: mypy
112112
# Running per-file misbehaves a bit, so just run on all files, it's fast
@@ -130,7 +130,7 @@ repos:
130130
args: ["-L", "nd,ot,thist", "--exclude-file", ".codespell-ignorelines"]
131131

132132
- repo: https://github.com/shellcheck-py/shellcheck-py
133-
rev: v0.8.0.1
133+
rev: v0.8.0.3
134134
hooks:
135135
- id: shellcheck
136136

docs/advanced/cast/custom.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type is explicitly allowed.
4646
* function signatures and declares a local variable
4747
* 'value' of type inty
4848
*/
49-
PYBIND11_TYPE_CASTER(inty, _("inty"));
49+
PYBIND11_TYPE_CASTER(inty, const_name("inty"));
5050
5151
/**
5252
* Conversion part 1 (Python->C++): convert a PyObject into a inty

docs/changelog.rst

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Starting with version 1.8.0, pybind11 releases use a `semantic versioning
77
<http://semver.org>`_ policy.
88

99

10-
IN DEVELOPMENT
11-
--------------
10+
Version 2.9.0 (Dec 28, 2021)
11+
----------------------------
12+
13+
This is the last version to support Python 2.7 and 3.5.
1214

1315
New Features:
1416

@@ -17,16 +19,17 @@ New Features:
1719
used.
1820
`#3402 <https://github.com/pybind/pybind11/pull/3402>`_
1921

20-
* Add C++ Exception type to throw and catch ``AttributeError``. Useful for
21-
defining custom ``__setattr__`` and ``__getattr__`` methods.
22-
`#3387 <https://github.com/pybind/pybind11/pull/3387>`_
22+
Changes:
2323

24-
Bug fixes:
24+
* Make str/bytes/memoryview more interoperable with ``std::string_view``.
25+
`#3521 <https://github.com/pybind/pybind11/pull/3521>`_
2526

26-
* Fix a regression in 2.8.0 that caused undefined behavior (typically
27-
segfaults) in ``make_key_iterator``/``make_value_iterator`` if dereferencing
28-
the iterator returned a temporary value instead of a reference.
29-
`#3348 <https://github.com/pybind/pybind11/pull/3348>`_
27+
* Replace ``_`` with ``const_name`` in internals, avoid defining ``pybind::_``
28+
if ``_`` defined as macro (common gettext usage)
29+
`#3423 <https://github.com/pybind/pybind11/pull/3423>`_
30+
31+
32+
Bug fixes:
3033

3134
* Fix a rare warning about extra copy in an Eigen constructor.
3235
`#3486 <https://github.com/pybind/pybind11/pull/3486>`_
@@ -37,27 +40,16 @@ Bug fixes:
3740
* Add missing ``std::forward`` calls to some ``cpp_function`` overloads.
3841
`#3443 <https://github.com/pybind/pybind11/pull/3443>`_
3942

40-
* Support PyPy 7.3.7 and the PyPy3.8 beta. Test python-3.11 on PRs with the ``python dev`` label.
43+
* Support PyPy 7.3.7 and the PyPy3.8 beta. Test python-3.11 on PRs with the
44+
``python dev`` label.
4145
`#3419 <https://github.com/pybind/pybind11/pull/3419>`_
4246

43-
* Fix 2.8.0 regression with MSVC 2017 + C++17 mode + Python 3.
44-
`#3407 <https://github.com/pybind/pybind11/pull/3407>`_
45-
46-
* Modernize usage of ``PyCodeObject`` on Python 3.9 (toward supporting Python
47-
3.11a1)
48-
`#3368 <https://github.com/pybind/pybind11/pull/3368>`_
49-
50-
* A long-standing bug in eigen.h was fixed (originally PR #3343). The bug was
51-
unmasked by newly added ``static_assert``'s in the Eigen 3.4.0 release.
52-
`#3352 <https://github.com/pybind/pybind11/pull/3352>`_
53-
5447
* Replace usage of deprecated ``Eigen::MappedSparseMatrix`` with
5548
``Eigen::Map<Eigen::SparseMatrix<...>>`` for Eigen 3.3+.
5649
`#3499 <https://github.com/pybind/pybind11/pull/3499>`_
5750

58-
* Fixed the potential for dangling references when using properties with
59-
``std::optional`` types.
60-
`#3376 <https://github.com/pybind/pybind11/pull/3376>`_
51+
* Tweaks to support Microsoft Visual Studio 2022.
52+
`#3497 <https://github.com/pybind/pybind11/pull/3497>`_
6153

6254
Build system improvements:
6355

@@ -68,17 +60,16 @@ Build system improvements:
6860
space in the package status message.
6961
`#3472 <https://github.com/pybind/pybind11/pull/3472>`_
7062

71-
* Support multiple raw inclusion of CMake helper files (Conan.io does this for
72-
multi-config generators).
73-
`#3420 <https://github.com/pybind/pybind11/pull/3420>`_
74-
75-
* Fix harmless warning on CMake 3.22.
76-
`#3368 <https://github.com/pybind/pybind11/pull/3368>`_
77-
7863
* Flags starting with ``-g`` in ``$CFLAGS`` and ``$CPPFLAGS`` are no longer
7964
overridden by ``.Pybind11Extension``.
8065
`#3436 <https://github.com/pybind/pybind11/pull/3436>`_
8166

67+
* Ensure ThreadPool is closed in ``setup_helpers``.
68+
`#3548 <https://github.com/pybind/pybind11/pull/3548>`_
69+
70+
* Avoid LTS on ``mips64`` and ``ppc64le`` (reported broken).
71+
`#3557 <https://github.com/pybind/pybind11/pull/3557>`_
72+
8273

8374
v2.8.1 (Oct 27, 2021)
8475
---------------------

docs/upgrade.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ v2.9
1717
converted to using ``py::module_::import("types").attr("SimpleNamespace")``
1818
instead.
1919

20+
* The use of ``_`` in custom type casters can now be replaced with the more
21+
readable ``const_name`` instead. The old ``_`` shortcut has been retained
22+
unless it is being used as a macro (like for gettext).
23+
2024

2125
.. _upgrade-guide-2.7:
2226

include/pybind11/cast.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct type_caster<T, enable_if_t<std::is_arithmetic<T>::value && !is_std_char_t
230230
return PyLong_FromUnsignedLongLong((unsigned long long) src);
231231
}
232232

233-
PYBIND11_TYPE_CASTER(T, _<std::is_integral<T>::value>("int", "float"));
233+
PYBIND11_TYPE_CASTER(T, const_name<std::is_integral<T>::value>("int", "float"));
234234
};
235235

236236
template<typename T> struct void_caster {
@@ -243,7 +243,7 @@ template<typename T> struct void_caster {
243243
static handle cast(T, return_value_policy /* policy */, handle /* parent */) {
244244
return none().inc_ref();
245245
}
246-
PYBIND11_TYPE_CASTER(T, _("None"));
246+
PYBIND11_TYPE_CASTER(T, const_name("None"));
247247
};
248248

249249
template <> class type_caster<void_type> : public void_caster<void_type> {};
@@ -286,7 +286,7 @@ template <> class type_caster<void> : public type_caster<void_type> {
286286

287287
template <typename T> using cast_op_type = void*&;
288288
explicit operator void *&() { return value; }
289-
static constexpr auto name = _("capsule");
289+
static constexpr auto name = const_name("capsule");
290290
private:
291291
void *value = nullptr;
292292
};
@@ -337,7 +337,7 @@ template <> class type_caster<bool> {
337337
static handle cast(bool src, return_value_policy /* policy */, handle /* parent */) {
338338
return handle(src ? Py_True : Py_False).inc_ref();
339339
}
340-
PYBIND11_TYPE_CASTER(bool, _("bool"));
340+
PYBIND11_TYPE_CASTER(bool, const_name("bool"));
341341
};
342342

343343
// Helper class for UTF-{8,16,32} C++ stl strings:
@@ -427,7 +427,7 @@ template <typename StringType, bool IsView = false> struct string_caster {
427427
return s;
428428
}
429429

430-
PYBIND11_TYPE_CASTER(StringType, _(PYBIND11_STRING_NAME));
430+
PYBIND11_TYPE_CASTER(StringType, const_name(PYBIND11_STRING_NAME));
431431

432432
private:
433433
static handle decode_utfN(const char *buffer, ssize_t nbytes) {
@@ -564,7 +564,7 @@ template <typename CharT> struct type_caster<CharT, enable_if_t<is_std_char_type
564564
return one_char;
565565
}
566566

567-
static constexpr auto name = _(PYBIND11_STRING_NAME);
567+
static constexpr auto name = const_name(PYBIND11_STRING_NAME);
568568
template <typename _T> using cast_op_type = pybind11::detail::cast_op_type<_T>;
569569
};
570570

@@ -601,7 +601,7 @@ template <template<typename...> class Tuple, typename... Ts> class tuple_caster
601601
return cast(*src, policy, parent);
602602
}
603603

604-
static constexpr auto name = _("Tuple[") + concat(make_caster<Ts>::name...) + _("]");
604+
static constexpr auto name = const_name("Tuple[") + concat(make_caster<Ts>::name...) + const_name("]");
605605

606606
template <typename T> using cast_op_type = type;
607607

@@ -790,14 +790,14 @@ template <typename base, typename holder> struct is_holder_type :
790790
template <typename base, typename deleter> struct is_holder_type<base, std::unique_ptr<base, deleter>> :
791791
std::true_type {};
792792

793-
template <typename T> struct handle_type_name { static constexpr auto name = _<T>(); };
794-
template <> struct handle_type_name<bytes> { static constexpr auto name = _(PYBIND11_BYTES_NAME); };
795-
template <> struct handle_type_name<int_> { static constexpr auto name = _("int"); };
796-
template <> struct handle_type_name<iterable> { static constexpr auto name = _("Iterable"); };
797-
template <> struct handle_type_name<iterator> { static constexpr auto name = _("Iterator"); };
798-
template <> struct handle_type_name<none> { static constexpr auto name = _("None"); };
799-
template <> struct handle_type_name<args> { static constexpr auto name = _("*args"); };
800-
template <> struct handle_type_name<kwargs> { static constexpr auto name = _("**kwargs"); };
793+
template <typename T> struct handle_type_name { static constexpr auto name = const_name<T>(); };
794+
template <> struct handle_type_name<bytes> { static constexpr auto name = const_name(PYBIND11_BYTES_NAME); };
795+
template <> struct handle_type_name<int_> { static constexpr auto name = const_name("int"); };
796+
template <> struct handle_type_name<iterable> { static constexpr auto name = const_name("Iterable"); };
797+
template <> struct handle_type_name<iterator> { static constexpr auto name = const_name("Iterator"); };
798+
template <> struct handle_type_name<none> { static constexpr auto name = const_name("None"); };
799+
template <> struct handle_type_name<args> { static constexpr auto name = const_name("*args"); };
800+
template <> struct handle_type_name<kwargs> { static constexpr auto name = const_name("**kwargs"); };
801801

802802
template <typename type>
803803
struct pyobject_caster {

include/pybind11/chrono.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ template <typename type> class duration_caster {
9797
return PyDelta_FromDSU(dd.count(), ss.count(), us.count());
9898
}
9999

100-
PYBIND11_TYPE_CASTER(type, _("datetime.timedelta"));
100+
PYBIND11_TYPE_CASTER(type, const_name("datetime.timedelta"));
101101
};
102102

103103
inline std::tm *localtime_thread_safe(const std::time_t *time, std::tm *buf) {
@@ -195,7 +195,7 @@ template <typename Duration> class type_caster<std::chrono::time_point<std::chro
195195
localtime.tm_sec,
196196
us.count());
197197
}
198-
PYBIND11_TYPE_CASTER(type, _("datetime.datetime"));
198+
PYBIND11_TYPE_CASTER(type, const_name("datetime.datetime"));
199199
};
200200

201201
// Other clocks that are not the system clock are not measured as datetime.datetime objects

include/pybind11/complex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ template <typename T> class type_caster<std::complex<T>> {
5959
return PyComplex_FromDoubles((double) src.real(), (double) src.imag());
6060
}
6161

62-
PYBIND11_TYPE_CASTER(std::complex<T>, _("complex"));
62+
PYBIND11_TYPE_CASTER(std::complex<T>, const_name("complex"));
6363
};
6464
PYBIND11_NAMESPACE_END(detail)
6565
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)

include/pybind11/detail/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
#define PYBIND11_VERSION_MAJOR 2
1313
#define PYBIND11_VERSION_MINOR 9
14-
#define PYBIND11_VERSION_PATCH 0.dev1
14+
#define PYBIND11_VERSION_PATCH 0
1515

1616
// Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
1717
// Additional convention: 0xD = dev
18-
#define PYBIND11_VERSION_HEX 0x020900D1
18+
#define PYBIND11_VERSION_HEX 0x02090000
1919

2020
#define PYBIND11_NAMESPACE_BEGIN(name) namespace name {
2121
#define PYBIND11_NAMESPACE_END(name) }

0 commit comments

Comments
 (0)