Skip to content

Commit 9cefe93

Browse files
committed
Merge branch 'master' into mannix/test/animal_cat_tiger
2 parents 35115c7 + 3878c23 commit 9cefe93

File tree

14 files changed

+129
-53
lines changed

14 files changed

+129
-53
lines changed

.github/workflows/tests-cibw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
runs-on: [macos-latest, macos-13]
38+
runs-on: [macos-14, macos-13]
3939
steps:
4040
- uses: actions/checkout@v4
4141
with:

docs/advanced/pycpp/numpy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ buffer objects (e.g. a NumPy matrix).
8888
py::buffer_info info = b.request();
8989
9090
/* Some basic validation checks ... */
91-
if (info.format != py::format_descriptor<Scalar>::format())
91+
if (!info.item_type_is_equivalent_to<Scalar>())
9292
throw std::runtime_error("Incompatible format: expected a double array!");
9393
9494
if (info.ndim != 2)

docs/changelog.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,92 @@ versioning](http://semver.org) policy.
1212
Changes will be added here periodically from the "Suggested changelog
1313
entry" block in pull request descriptions.
1414

15+
16+
## Version 3.0.1 (August 22, 2025)
17+
18+
Bug fixes:
19+
20+
- Fixed compilation error in `type_caster_enum_type` when casting
21+
pointer-to-enum types. Added pointer overload to handle dereferencing before
22+
enum conversion.
23+
[#5776](https://github.com/pybind/pybind11/pull/5776)
24+
25+
- Implement binary version of `make_index_sequence` to reduce template depth
26+
requirements for functions with many parameters.
27+
[#5751](https://github.com/pybind/pybind11/pull/5751)
28+
29+
- Subinterpreter-specific exception handling code was removed to resolve segfaults.
30+
[#5795](https://github.com/pybind/pybind11/pull/5795)
31+
32+
- Fixed issue that caused ``PYBIND11_MODULE`` code to run again if the module
33+
was re-imported after being deleted from ``sys.modules``.
34+
[#5782](https://github.com/pybind/pybind11/pull/5782)
35+
36+
- Prevent concurrent creation of sub-interpreters as a workaround for stdlib
37+
concurrency issues in Python 3.12.
38+
[#5779](https://github.com/pybind/pybind11/pull/5779)
39+
40+
- Fixed potential crash when using `cpp_function` objects with sub-interpreters.
41+
[#5771](https://github.com/pybind/pybind11/pull/5771)
42+
43+
- Fixed non-entrant check in `implicitly_convertible()`.
44+
[#5777](https://github.com/pybind/pybind11/pull/5777)
45+
46+
- Support C++20 on platforms that have older c++ runtimes.
47+
[#5761](https://github.com/pybind/pybind11/pull/5761)
48+
49+
- Fix compilation with clang on msys2.
50+
[#5757](https://github.com/pybind/pybind11/pull/5757)
51+
52+
- Avoid `nullptr` dereference warning with GCC 13.3.0 and python 3.11.13.
53+
[#5756](https://github.com/pybind/pybind11/pull/5756)
54+
55+
- Fix potential warning about number of threads being too large.
56+
[#5807](https://github.com/pybind/pybind11/pull/5807)
57+
58+
59+
<!-- fix(cmake) -->
60+
61+
- Fix gcc 11.4+ warning about serial compilation using CMake.
62+
[#5791](https://github.com/pybind/pybind11/pull/5791)
63+
64+
65+
Documentation:
66+
67+
- Improve `buffer_info` type checking in numpy docs.
68+
[#5805](https://github.com/pybind/pybind11/pull/5805)
69+
70+
- Replace `robotpy-build` with `semiwrap` in the binding tool list.
71+
[#5804](https://github.com/pybind/pybind11/pull/5804)
72+
73+
- Show nogil in most examples.
74+
[#5770](https://github.com/pybind/pybind11/pull/5770)
75+
76+
- Fix `py::trampoline_self_life_support` visibility in docs.
77+
[#5766](https://github.com/pybind/pybind11/pull/5766)
78+
79+
80+
Tests:
81+
82+
- Avoid a spurious warning about `DOWNLOAD_CATCH` being manually specified.
83+
[#5803](https://github.com/pybind/pybind11/pull/5803)
84+
85+
- Fix an IsolatedConfig test.
86+
[#5768](https://github.com/pybind/pybind11/pull/5768)
87+
88+
89+
CI:
90+
91+
- Add CI testing for Android.
92+
[#5714](https://github.com/pybind/pybind11/pull/5714)
93+
94+
95+
Internal:
96+
97+
- Rename internal variables to avoid the word `slots` (reads better).
98+
[#5793](https://github.com/pybind/pybind11/pull/5793)
99+
100+
15101
## Version 3.0.0 (July 10, 2025)
16102

17103
Pybind11 3.0 includes an ABI bump, the first required bump in many years

docs/compiling.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,12 +712,15 @@ classes or incorporating modern meta-programming constructs.
712712

713713
.. [AutoWIG] https://github.com/StatisKit/AutoWIG
714714
715-
[robotpy-build]_ is a is a pure python, cross platform build tool that aims to
716-
simplify creation of python wheels for pybind11 projects, and provide
717-
cross-project dependency management. Additionally, it is able to autogenerate
718-
customizable pybind11-based wrappers by parsing C++ header files.
719-
720-
.. [robotpy-build] https://robotpy-build.readthedocs.io
715+
[semiwrap]_ is a build tool that makes it simpler to wrap C/C++ libraries with
716+
pybind11 by automating large portions of the wrapping process and handling some
717+
of the more complex aspects of creating pybind11 based wrappers (especially with
718+
trampolines to allow inheriting from C++ classes from Python). It includes a
719+
hatchling plugin that autogenerates meson.build files that can be built using
720+
meson, and those build files parse your wrapped headers and generate/compile
721+
pybind11 based wrappers into python extension modules.
722+
723+
.. [semiwrap] https://semiwrap.readthedocs.io
721724
722725
[litgen]_ is an automatic python bindings generator with a focus on generating
723726
documented and discoverable bindings: bindings will nicely reproduce the documentation

docs/installing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Global install with brew
8787

8888
The brew package manager (Homebrew on macOS, or Linuxbrew on Linux) has a
8989
`pybind11 package
90-
<https://github.com/Homebrew/homebrew-core/blob/master/Formula/pybind11.rb>`_.
90+
<https://github.com/Homebrew/homebrew-core/blob/master/Formula/p/pybind11.rb>`_.
9191
To install:
9292

9393
.. code-block:: bash

include/pybind11/detail/common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
/* -- start version constants -- */
2020
#define PYBIND11_VERSION_MAJOR 3
2121
#define PYBIND11_VERSION_MINOR 0
22-
#define PYBIND11_VERSION_MICRO 1
22+
#define PYBIND11_VERSION_MICRO 2
2323
// ALPHA = 0xA, BETA = 0xB, GAMMA = 0xC (release candidate), FINAL = 0xF (stable release)
2424
// - The release level is set to "alpha" for development versions.
2525
// Use 0xA0 (LEVEL=0xA, SERIAL=0) for development versions.
2626
// - For stable releases, set the serial to 0.
2727
#define PYBIND11_VERSION_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
2828
#define PYBIND11_VERSION_RELEASE_SERIAL 0
2929
// String version of (micro, release level, release serial), e.g.: 0a0, 0b1, 0rc1, 0
30-
#define PYBIND11_VERSION_PATCH 1a0
30+
#define PYBIND11_VERSION_PATCH 2a0
3131
/* -- end version constants -- */
3232

3333
#if !defined(Py_PACK_FULL_VERSION)
@@ -436,14 +436,14 @@ PyModuleDef_Init should be treated like any other PyObject (so not shared across
436436
PYBIND11_CHECK_PYTHON_VERSION \
437437
pre_init; \
438438
PYBIND11_ENSURE_INTERNALS_READY \
439-
static ::pybind11::detail::slots_array slots = ::pybind11::detail::init_slots( \
439+
static ::pybind11::detail::slots_array mod_def_slots = ::pybind11::detail::init_slots( \
440440
&PYBIND11_CONCAT(pybind11_exec_, name), ##__VA_ARGS__); \
441441
static PyModuleDef def{/* m_base */ PyModuleDef_HEAD_INIT, \
442442
/* m_name */ PYBIND11_TOSTRING(name), \
443443
/* m_doc */ nullptr, \
444444
/* m_size */ 0, \
445445
/* m_methods */ nullptr, \
446-
/* m_slots */ slots.data(), \
446+
/* m_slots */ mod_def_slots.data(), \
447447
/* m_traverse */ nullptr, \
448448
/* m_clear */ nullptr, \
449449
/* m_free */ nullptr}; \

include/pybind11/detail/internals.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include "struct_smart_holder.h"
1919

2020
#include <atomic>
21+
#include <cstdint>
2122
#include <exception>
23+
#include <limits>
2224
#include <mutex>
2325
#include <thread>
2426

@@ -274,8 +276,10 @@ struct internals {
274276
registered_exception_translators.push_front(&translate_exception);
275277
#ifdef Py_GIL_DISABLED
276278
// Scale proportional to the number of cores. 2x is a heuristic to reduce contention.
277-
auto num_shards
278-
= static_cast<size_t>(round_up_to_next_pow2(2 * std::thread::hardware_concurrency()));
279+
// Make sure the number isn't unreasonable by limiting it to 16 bits (65K)
280+
auto num_shards = static_cast<std::uint16_t>(
281+
std::min<std::size_t>(round_up_to_next_pow2(2 * std::thread::hardware_concurrency()),
282+
std::numeric_limits<std::uint16_t>::max()));
279283
if (num_shards == 0) {
280284
num_shards = 1;
281285
}

include/pybind11/detail/pybind11_namespace_macros.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
// possible using these macros. Please also be sure to push/pop with the pybind11 macros. Please
1717
// only use compiler specifics if you need to check specific versions, e.g. Apple Clang vs. vanilla
1818
// Clang.
19-
#if defined(_MSC_VER)
20-
# define PYBIND11_COMPILER_MSVC
21-
# define PYBIND11_PRAGMA(...) __pragma(__VA_ARGS__)
22-
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning(push))
23-
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning(pop))
24-
#elif defined(__INTEL_COMPILER)
19+
#if defined(__INTEL_COMPILER)
2520
# define PYBIND11_COMPILER_INTEL
2621
# define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
2722
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning push)
@@ -36,6 +31,11 @@
3631
# define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
3732
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(GCC diagnostic push)
3833
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(GCC diagnostic pop)
34+
#elif defined(_MSC_VER) // Must be after the clang branch because clang-cl also defines _MSC_VER
35+
# define PYBIND11_COMPILER_MSVC
36+
# define PYBIND11_PRAGMA(...) __pragma(__VA_ARGS__)
37+
# define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning(push))
38+
# define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning(pop))
3939
#endif
4040

4141
#ifdef PYBIND11_COMPILER_MSVC

include/pybind11/pybind11.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,29 +1388,29 @@ template <typename... Options>
13881388
inline slots_array init_slots(int (*exec_fn)(PyObject *), Options &&...options) noexcept {
13891389
/* NOTE: slots_array MUST be large enough to hold all possible options. If you add an option
13901390
here, you MUST also increase the size of slots_array in the type alias above! */
1391-
slots_array slots;
1391+
slots_array mod_def_slots;
13921392
size_t next_slot = 0;
13931393

1394-
slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
1394+
mod_def_slots[next_slot++] = {Py_mod_create, reinterpret_cast<void *>(&cached_create_module)};
13951395

13961396
if (exec_fn != nullptr) {
1397-
slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
1397+
mod_def_slots[next_slot++] = {Py_mod_exec, reinterpret_cast<void *>(exec_fn)};
13981398
}
13991399

14001400
#ifdef Py_mod_multiple_interpreters
1401-
slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
1401+
mod_def_slots[next_slot++] = {Py_mod_multiple_interpreters, multi_interp_slot(options...)};
14021402
#endif
14031403

14041404
if (gil_not_used_option(options...)) {
14051405
#if defined(Py_mod_gil) && defined(Py_GIL_DISABLED)
1406-
slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
1406+
mod_def_slots[next_slot++] = {Py_mod_gil, Py_MOD_GIL_NOT_USED};
14071407
#endif
14081408
}
14091409

14101410
// slots must have a zero end sentinel
1411-
slots[next_slot++] = {0, nullptr};
1411+
mod_def_slots[next_slot++] = {0, nullptr};
14121412

1413-
return slots;
1413+
return mod_def_slots;
14141414
}
14151415

14161416
PYBIND11_NAMESPACE_END(detail)

include/pybind11/stl/filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#elif defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM)
1818
# include <experimental/filesystem>
1919
#else
20-
# error "Neither #include <filesystem> nor #include <experimental/filesystem is available."
20+
# error "Neither #include <filesystem> nor #include <experimental/filesystem> is available."
2121
#endif
2222

2323
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

0 commit comments

Comments
 (0)