From 6b077fad15446a750ed4784a569acabbcc371f71 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 15 Aug 2025 17:43:55 -0400 Subject: [PATCH 01/10] tests: add linking warnings/error Signed-off-by: Henry Schreiner --- tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ebd3fff1c2..9cb13a227a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -411,6 +411,7 @@ function(pybind11_enable_warnings target_name) -Wdeprecated -Wundef -Wnon-virtual-dtor) + target_link_options(${target_name} PRIVATE -Werror -Wodr -Wlto-type-mismatch) if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 20) target_compile_options(${target_name} PRIVATE -Wpedantic) endif() From 7f34adf42d9a53ea3c76ff23d068f9e5529ee2dd Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 15 Aug 2025 23:31:18 -0400 Subject: [PATCH 02/10] tests: check pedantic C++14 --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9cb13a227a..0b23135993 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -412,7 +412,7 @@ function(pybind11_enable_warnings target_name) -Wundef -Wnon-virtual-dtor) target_link_options(${target_name} PRIVATE -Werror -Wodr -Wlto-type-mismatch) - if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 20) + if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 14) target_compile_options(${target_name} PRIVATE -Wpedantic) endif() endif() From 9aa3ab40058c33575ffe076ab4e86c3393b91a63 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 19 Aug 2025 10:43:50 -0400 Subject: [PATCH 03/10] fix: some pedantic warnings Signed-off-by: Henry Schreiner --- tests/exo_planet_pybind11.cpp | 2 +- tests/home_planet_very_lonely_traveler.cpp | 2 +- ...st_class_sh_trampoline_shared_ptr_cpp_arg.cpp | 2 +- tests/test_class_sh_trampoline_unique_ptr.cpp | 4 ++-- tests/test_class_sh_virtual_py_cpp_mix.cpp | 4 ++-- tests/test_cross_module_rtti/bindings.cpp | 4 ++-- tests/test_embed/test_interpreter.cpp | 6 +++--- tests/test_potentially_slicing_weak_ptr.cpp | 4 ++-- tests/test_smart_ptr.cpp | 10 +++++----- tests/test_virtual_functions.cpp | 16 ++++++++-------- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/exo_planet_pybind11.cpp b/tests/exo_planet_pybind11.cpp index 9d1a2b84b6..011b3a92c5 100644 --- a/tests/exo_planet_pybind11.cpp +++ b/tests/exo_planet_pybind11.cpp @@ -10,7 +10,7 @@ namespace pybind11_tests { namespace test_cpp_conduit { -PYBIND11_MODULE(exo_planet_pybind11, m) { +PYBIND11_MODULE(exo_planet_pybind11, m, ) { wrap_traveler(m); m.def("wrap_very_lonely_traveler", [m]() { wrap_very_lonely_traveler(m); }); } diff --git a/tests/home_planet_very_lonely_traveler.cpp b/tests/home_planet_very_lonely_traveler.cpp index 78d50cff5d..46c7f59c9e 100644 --- a/tests/home_planet_very_lonely_traveler.cpp +++ b/tests/home_planet_very_lonely_traveler.cpp @@ -5,7 +5,7 @@ namespace pybind11_tests { namespace test_cpp_conduit { -PYBIND11_MODULE(home_planet_very_lonely_traveler, m) { +PYBIND11_MODULE(home_planet_very_lonely_traveler, m, ) { m.def("wrap_very_lonely_traveler", [m]() { wrap_very_lonely_traveler(m); }); } diff --git a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp index 5580848c6e..3daea7b55d 100644 --- a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp +++ b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp @@ -30,7 +30,7 @@ std::shared_ptr pass_through_shd_ptr(const std::shared_ptr &obj) struct PySpBase : SpBase, py::trampoline_self_life_support { using SpBase::SpBase; - bool is_base_used() override { PYBIND11_OVERRIDE(bool, SpBase, is_base_used); } + bool is_base_used() override { PYBIND11_OVERRIDE(bool, SpBase, is_base_used, ); } }; struct SpBaseTester { diff --git a/tests/test_class_sh_trampoline_unique_ptr.cpp b/tests/test_class_sh_trampoline_unique_ptr.cpp index debe3324eb..0aeeaa9ef5 100644 --- a/tests/test_class_sh_trampoline_unique_ptr.cpp +++ b/tests/test_class_sh_trampoline_unique_ptr.cpp @@ -39,10 +39,10 @@ namespace class_sh_trampoline_unique_ptr { class PyClass : public Class, public py::trampoline_self_life_support { public: std::unique_ptr clone() const override { - PYBIND11_OVERRIDE_PURE(std::unique_ptr, Class, clone); + PYBIND11_OVERRIDE_PURE(std::unique_ptr, Class, clone, ); } - int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); } + int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo, ); } }; } // namespace class_sh_trampoline_unique_ptr diff --git a/tests/test_class_sh_virtual_py_cpp_mix.cpp b/tests/test_class_sh_virtual_py_cpp_mix.cpp index df8af19e48..8b8c2b1873 100644 --- a/tests/test_class_sh_virtual_py_cpp_mix.cpp +++ b/tests/test_class_sh_virtual_py_cpp_mix.cpp @@ -32,13 +32,13 @@ int get_from_cpp_unique_ptr(std::unique_ptr b) { return b->get() + 5000; } struct BaseVirtualOverrider : Base, py::trampoline_self_life_support { using Base::Base; - int get() const override { PYBIND11_OVERRIDE(int, Base, get); } + int get() const override { PYBIND11_OVERRIDE(int, Base, get, ); } }; struct CppDerivedVirtualOverrider : CppDerived, py::trampoline_self_life_support { using CppDerived::CppDerived; - int get() const override { PYBIND11_OVERRIDE(int, CppDerived, get); } + int get() const override { PYBIND11_OVERRIDE(int, CppDerived, get, ); } }; } // namespace class_sh_virtual_py_cpp_mix diff --git a/tests/test_cross_module_rtti/bindings.cpp b/tests/test_cross_module_rtti/bindings.cpp index 94fa6874f8..d6f589b08f 100644 --- a/tests/test_cross_module_rtti/bindings.cpp +++ b/tests/test_cross_module_rtti/bindings.cpp @@ -5,10 +5,10 @@ class BaseTrampoline : public lib::Base, public pybind11::trampoline_self_life_support { public: using lib::Base::Base; - int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get); } + int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get, ); } }; -PYBIND11_MODULE(test_cross_module_rtti_bindings, m) { +PYBIND11_MODULE(test_cross_module_rtti_bindings, m, ) { pybind11::classh(m, "Base") .def(pybind11::init()) .def_readwrite("a", &lib::Base::a) diff --git a/tests/test_embed/test_interpreter.cpp b/tests/test_embed/test_interpreter.cpp index 0e6c17a777..8f168e3647 100644 --- a/tests/test_embed/test_interpreter.cpp +++ b/tests/test_embed/test_interpreter.cpp @@ -45,8 +45,8 @@ class Widget { class PyWidget final : public Widget { using Widget::Widget; - int the_answer() const override { PYBIND11_OVERRIDE_PURE(int, Widget, the_answer); } - std::string argv0() const override { PYBIND11_OVERRIDE_PURE(std::string, Widget, argv0); } + int the_answer() const override { PYBIND11_OVERRIDE_PURE(int, Widget, the_answer, ); } + std::string argv0() const override { PYBIND11_OVERRIDE_PURE(std::string, Widget, argv0, ); } }; class test_override_cache_helper { @@ -62,7 +62,7 @@ class test_override_cache_helper { }; class test_override_cache_helper_trampoline : public test_override_cache_helper { - int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func); } + int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func, ); } }; PYBIND11_EMBEDDED_MODULE(widget_module, m, py::multiple_interpreters::per_interpreter_gil()) { diff --git a/tests/test_potentially_slicing_weak_ptr.cpp b/tests/test_potentially_slicing_weak_ptr.cpp index 01b147faff..f3f9c39d00 100644 --- a/tests/test_potentially_slicing_weak_ptr.cpp +++ b/tests/test_potentially_slicing_weak_ptr.cpp @@ -56,12 +56,12 @@ const char *determine_trampoline_state(const std::shared_ptr &sp) { struct PyVirtBaseSH : VirtBaseSH, py::trampoline_self_life_support, trampoline_is_alive_simple { using VirtBaseSH::VirtBaseSH; - int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSH, get_code); } + int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSH, get_code, ); } }; struct PyVirtBaseSP : VirtBaseSP, trampoline_is_alive_simple { // self-life-support not available using VirtBaseSP::VirtBaseSP; - int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSP, get_code); } + int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSP, get_code, ); } }; template diff --git a/tests/test_smart_ptr.cpp b/tests/test_smart_ptr.cpp index 5fdd69db38..439c78fc17 100644 --- a/tests/test_smart_ptr.cpp +++ b/tests/test_smart_ptr.cpp @@ -313,11 +313,11 @@ struct holder_helper> { PYBIND11_DECLARE_HOLDER_TYPE(T, ref, true) PYBIND11_DECLARE_HOLDER_TYPE(T, const_only_shared_ptr, true) // The following is not required anymore for std::shared_ptr, but it should compile without error: -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr) -PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr) -PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr) -PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator) -PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator) +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr, ) +PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr, ) +PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr, ) +PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator, ) +PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator, ) namespace holder_caster_traits_test { struct example_base {}; diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp index a6164eb81d..3a85ad8c78 100644 --- a/tests/test_virtual_functions.cpp +++ b/tests/test_virtual_functions.cpp @@ -220,7 +220,7 @@ class test_override_cache_helper { }; class test_override_cache_helper_trampoline : public test_override_cache_helper { - int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func); } + int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func, ); } }; inline int test_override_cache(std::shared_ptr const &instance) { @@ -280,7 +280,7 @@ TEST_SUBMODULE(virtual_functions, m) { py::print("PyA.f()"); // This convolution just gives a `void`, but tests that PYBIND11_TYPE() works to // protect a type containing a , - PYBIND11_OVERRIDE(PYBIND11_TYPE(typename std::enable_if::type), A, f); + PYBIND11_OVERRIDE(PYBIND11_TYPE(typename std::enable_if::type), A, f, ); } }; @@ -303,7 +303,7 @@ TEST_SUBMODULE(virtual_functions, m) { ~PyA2() override { py::print("PyA2.~PyA2()"); } void f() override { py::print("PyA2.f()"); - PYBIND11_OVERRIDE(void, A2, f); + PYBIND11_OVERRIDE(void, A2, f, ); } }; @@ -371,26 +371,26 @@ TEST_SUBMODULE(virtual_functions, m) { public: using OverrideTest::OverrideTest; std::string str_value() override { - PYBIND11_OVERRIDE(std::string, OverrideTest, str_value); + PYBIND11_OVERRIDE(std::string, OverrideTest, str_value, ); } // Not allowed (enabling the below should hit a static_assert failure): we can't get a // reference to a python numeric value, since we only copy values in the numeric type // caster: #ifdef PYBIND11_NEVER_DEFINED_EVER std::string &str_ref() override { - PYBIND11_OVERRIDE(std::string &, OverrideTest, str_ref); + PYBIND11_OVERRIDE(std::string &, OverrideTest, str_ref, ); } #endif // But we can work around it like this: private: std::string _tmp; - std::string str_ref_helper() { PYBIND11_OVERRIDE(std::string, OverrideTest, str_ref); } + std::string str_ref_helper() { PYBIND11_OVERRIDE(std::string, OverrideTest, str_ref, ); } public: std::string &str_ref() override { return _tmp = str_ref_helper(); } - A A_value() override { PYBIND11_OVERRIDE(A, OverrideTest, A_value); } - A &A_ref() override { PYBIND11_OVERRIDE(A &, OverrideTest, A_ref); } + A A_value() override { PYBIND11_OVERRIDE(A, OverrideTest, A_value, ); } + A &A_ref() override { PYBIND11_OVERRIDE(A &, OverrideTest, A_ref, ); } }; py::class_(m, "OverrideTest_A") From 918fb7265e99dfc40196105606b7dc0eac8acc83 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 20 Aug 2025 00:46:42 -0400 Subject: [PATCH 04/10] feat: add py::mod_gil_used() Signed-off-by: Henry Schreiner --- include/pybind11/pybind11.h | 2 ++ tests/exo_planet_pybind11.cpp | 2 +- tests/extra_setuptools/test_setuphelper.py | 2 +- tests/home_planet_very_lonely_traveler.cpp | 2 +- tests/test_cross_module_rtti/bindings.cpp | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 76519ad2f7..6ba6952f4e 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1270,6 +1270,8 @@ class mod_gil_not_used { bool flag_; }; +inline mod_gil_not_used mod_gil_used() { return mod_gil_not_used(false); } + class multiple_interpreters { public: enum class level { diff --git a/tests/exo_planet_pybind11.cpp b/tests/exo_planet_pybind11.cpp index 011b3a92c5..1641b19f2e 100644 --- a/tests/exo_planet_pybind11.cpp +++ b/tests/exo_planet_pybind11.cpp @@ -10,7 +10,7 @@ namespace pybind11_tests { namespace test_cpp_conduit { -PYBIND11_MODULE(exo_planet_pybind11, m, ) { +PYBIND11_MODULE(exo_planet_pybind11, m, pybind11::mod_gil_used()) { wrap_traveler(m); m.def("wrap_very_lonely_traveler", [m]() { wrap_very_lonely_traveler(m); }); } diff --git a/tests/extra_setuptools/test_setuphelper.py b/tests/extra_setuptools/test_setuphelper.py index 2c069adffb..22c0c76f5d 100644 --- a/tests/extra_setuptools/test_setuphelper.py +++ b/tests/extra_setuptools/test_setuphelper.py @@ -65,7 +65,7 @@ def test_simple_setup_py(monkeypatch, tmpdir, parallel, std): int f(int x) { return x * 3; } - PYBIND11_MODULE(simple_setup, m) { + PYBIND11_MODULE(simple_setup, m, pybind11::mod_gil_used()) { m.def("f", &f); } """ diff --git a/tests/home_planet_very_lonely_traveler.cpp b/tests/home_planet_very_lonely_traveler.cpp index 46c7f59c9e..2a9fc4490a 100644 --- a/tests/home_planet_very_lonely_traveler.cpp +++ b/tests/home_planet_very_lonely_traveler.cpp @@ -5,7 +5,7 @@ namespace pybind11_tests { namespace test_cpp_conduit { -PYBIND11_MODULE(home_planet_very_lonely_traveler, m, ) { +PYBIND11_MODULE(home_planet_very_lonely_traveler, m, py::mod_gil_used()) { m.def("wrap_very_lonely_traveler", [m]() { wrap_very_lonely_traveler(m); }); } diff --git a/tests/test_cross_module_rtti/bindings.cpp b/tests/test_cross_module_rtti/bindings.cpp index d6f589b08f..4bd7d37a4f 100644 --- a/tests/test_cross_module_rtti/bindings.cpp +++ b/tests/test_cross_module_rtti/bindings.cpp @@ -8,7 +8,7 @@ class BaseTrampoline : public lib::Base, public pybind11::trampoline_self_life_s int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get, ); } }; -PYBIND11_MODULE(test_cross_module_rtti_bindings, m, ) { +PYBIND11_MODULE(test_cross_module_rtti_bindings, m, pybind11::mod_gil_used()) { pybind11::classh(m, "Base") .def(pybind11::init()) .def_readwrite("a", &lib::Base::a) From c607b41bfaee3d0482b3a4ba1da5ad856cb46254 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 20 Aug 2025 01:31:39 -0400 Subject: [PATCH 05/10] fix: use not_supported() Signed-off-by: Henry Schreiner --- tests/test_cmake_build/embed.cpp | 4 +++- tests/test_embed/test_interpreter.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test_cmake_build/embed.cpp b/tests/test_cmake_build/embed.cpp index 30bc4f1e14..45f263a111 100644 --- a/tests/test_cmake_build/embed.cpp +++ b/tests/test_cmake_build/embed.cpp @@ -1,7 +1,9 @@ +#include #include + namespace py = pybind11; -PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) { +PYBIND11_EMBEDDED_MODULE(test_cmake_build, m, py::multiple_interpreters::not_supported()) { m.def("add", [](int i, int j) { return i + j; }); } diff --git a/tests/test_embed/test_interpreter.cpp b/tests/test_embed/test_interpreter.cpp index 8f168e3647..55b64d82aa 100644 --- a/tests/test_embed/test_interpreter.cpp +++ b/tests/test_embed/test_interpreter.cpp @@ -1,5 +1,6 @@ #include #include +#include // Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to // catch 2.0.1; this should be fixed in the next catch release after 2.0.1). @@ -76,7 +77,7 @@ PYBIND11_EMBEDDED_MODULE(widget_module, m, py::multiple_interpreters::per_interp sub.def("add", [](int i, int j) { return i + j; }); } -PYBIND11_EMBEDDED_MODULE(trampoline_module, m) { +PYBIND11_EMBEDDED_MODULE(trampoline_module, m, py::multiple_interpreters::not_supported()) { py::class_>(m, "test_override_cache_helper") @@ -84,9 +85,11 @@ PYBIND11_EMBEDDED_MODULE(trampoline_module, m) { .def("func", &test_override_cache_helper::func); } -PYBIND11_EMBEDDED_MODULE(throw_exception, ) { throw std::runtime_error("C++ Error"); } +PYBIND11_EMBEDDED_MODULE(throw_exception, , py::multiple_interpreters::not_supported()) { + throw std::runtime_error("C++ Error"); +} -PYBIND11_EMBEDDED_MODULE(throw_error_already_set, ) { +PYBIND11_EMBEDDED_MODULE(throw_error_already_set, , py::multiple_interpreters::not_supported()) { auto d = py::dict(); d["missing"].cast(); } From 6d15c04b3b184f2b9279713f8ba1535e93edf2a3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 05:32:17 +0000 Subject: [PATCH 06/10] style: pre-commit fixes --- tests/test_cmake_build/embed.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_cmake_build/embed.cpp b/tests/test_cmake_build/embed.cpp index 45f263a111..dabe03af0e 100644 --- a/tests/test_cmake_build/embed.cpp +++ b/tests/test_cmake_build/embed.cpp @@ -1,5 +1,5 @@ -#include #include +#include namespace py = pybind11; From 7ade9847f23347b652b0fd5c7803fb33edc8d9b5 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Aug 2025 11:17:18 -0400 Subject: [PATCH 07/10] Update CMakeLists.txt --- tests/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0b23135993..9218238532 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -406,15 +406,13 @@ function(pybind11_enable_warnings target_name) ${target_name} PRIVATE -Wall -Wextra + -Wpedantic -Wconversion -Wcast-qual -Wdeprecated -Wundef -Wnon-virtual-dtor) target_link_options(${target_name} PRIVATE -Werror -Wodr -Wlto-type-mismatch) - if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 14) - target_compile_options(${target_name} PRIVATE -Wpedantic) - endif() endif() if(PYBIND11_WERROR) From cef0ea77fc9f6aa551685943a6653772aa5b6208 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Aug 2025 16:06:11 -0400 Subject: [PATCH 08/10] fix: remove the true/false parameter from mod_gil_not_used Signed-off-by: Henry Schreiner --- include/pybind11/pybind11.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 6ba6952f4e..2d33f669f8 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1263,11 +1263,14 @@ PYBIND11_NAMESPACE_END(detail) // Use to activate Py_MOD_GIL_NOT_USED. class mod_gil_not_used { public: - explicit mod_gil_not_used(bool flag = true) : flag_(flag) {} + mod_gil_not_used() : flag_(true) {} bool flag() const { return flag_; } + friend mod_gil_not_used mod_gil_used(); + private: bool flag_; + explicit mod_gil_not_used(bool flag) : flag_(flag) {} }; inline mod_gil_not_used mod_gil_used() { return mod_gil_not_used(false); } @@ -1540,7 +1543,7 @@ class module_ : public object { const char *doc, PyModuleDef *def, mod_gil_not_used gil_not_used - = mod_gil_not_used(false)) { + = mod_gil_used()) { // Placement new (not an allocation). new (def) PyModuleDef{/* m_base */ PyModuleDef_HEAD_INIT, /* m_name */ name, From a4ef647b818aa51fdf2669f810cc15279f7b393b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:22:17 +0000 Subject: [PATCH 09/10] style: pre-commit fixes --- include/pybind11/pybind11.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 2d33f669f8..4086754793 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1542,8 +1542,7 @@ class module_ : public object { static module_ create_extension_module(const char *name, const char *doc, PyModuleDef *def, - mod_gil_not_used gil_not_used - = mod_gil_used()) { + mod_gil_not_used gil_not_used = mod_gil_used()) { // Placement new (not an allocation). new (def) PyModuleDef{/* m_base */ PyModuleDef_HEAD_INIT, /* m_name */ name, From 4603cb80398e48995e13573abb2b75c0e7360d83 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Aug 2025 18:29:26 -0400 Subject: [PATCH 10/10] Update tests/CMakeLists.txt --- tests/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9218238532..3beb8a4621 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -412,7 +412,6 @@ function(pybind11_enable_warnings target_name) -Wdeprecated -Wundef -Wnon-virtual-dtor) - target_link_options(${target_name} PRIVATE -Werror -Wodr -Wlto-type-mismatch) endif() if(PYBIND11_WERROR)