From b07975f492c2eed0409a18353fa23c9969e83e42 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Fri, 22 Jul 2022 11:52:01 -0400 Subject: [PATCH 1/9] Fix missing undef in pytypes (#4087) --- include/pybind11/pytypes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index a837fb9fa..6ba1f5f20 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -2420,6 +2420,7 @@ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator>>=, PyNumber_InPlaceRshift) #undef PYBIND11_MATH_OPERATOR_UNARY #undef PYBIND11_MATH_OPERATOR_BINARY +#undef PYBIND11_MATH_OPERATOR_BINARY_INPLACE PYBIND11_NAMESPACE_END(detail) PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) From d70f54b073d9961a4b9eebd151e721a1172ecada Mon Sep 17 00:00:00 2001 From: Hyunwook Choi Date: Thu, 28 Jul 2022 02:41:57 +0900 Subject: [PATCH 2/9] docs: Missing semicolons (#4094) Add semicolons to Memory view sample code --- docs/advanced/pycpp/numpy.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced/pycpp/numpy.rst b/docs/advanced/pycpp/numpy.rst index b6ef019ed..07c969305 100644 --- a/docs/advanced/pycpp/numpy.rst +++ b/docs/advanced/pycpp/numpy.rst @@ -433,7 +433,7 @@ following: { 2, 4 }, // shape (rows, cols) { sizeof(uint8_t) * 4, sizeof(uint8_t) } // strides in bytes ); - }) + }); This approach is meant for providing a ``memoryview`` for a C/C++ buffer not managed by Python. The user is responsible for managing the lifetime of the @@ -449,7 +449,7 @@ We can also use ``memoryview::from_memory`` for a simple 1D contiguous buffer: buffer, // buffer pointer sizeof(uint8_t) * 8 // buffer size ); - }) + }); .. versionchanged:: 2.6 ``memoryview::from_memory`` added. From 1e3400b6742288429f2069aaf5febf92d0662dae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Jul 2022 21:37:47 -0400 Subject: [PATCH 3/9] chore(deps): bump pypa/gh-action-pypi-publish from 1.5.0 to 1.5.1 (#4091) Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.5.0...v1.5.1) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 2c16735e1..f03a39701 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -98,13 +98,13 @@ jobs: - uses: actions/download-artifact@v3 - name: Publish standard package - uses: pypa/gh-action-pypi-publish@v1.5.0 + uses: pypa/gh-action-pypi-publish@v1.5.1 with: password: ${{ secrets.pypi_password }} packages_dir: standard/ - name: Publish global package - uses: pypa/gh-action-pypi-publish@v1.5.0 + uses: pypa/gh-action-pypi-publish@v1.5.1 with: password: ${{ secrets.pypi_password_global }} packages_dir: global/ From 3665530264bbfeb9ec7623635d7cc644a70116b3 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 1 Aug 2022 06:18:48 -0700 Subject: [PATCH 4/9] Add `-DPYBIND11_WERROR=ON` to mingw cmake commands (#4073) * Add `-DPYBIND11_WERROR=ON` to mingw cmake commands (and `-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON`). * Using no-destructor idiom to side-step overzealous MINGW warning. * Add __MINGW32__ pragma GCC diagnostic ignored in eigen.h * Add another no-destructor workaround. * Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings. * Revert "Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings." This reverts commit f36b0af8f93e9f6f16c969fb5b646e116f5eaf0f. * Very minor shuffle to avoid MSVC warnings. * Remove all `:BOOL` as suggested by @henryiii --- .github/workflows/ci.yml | 6 +++--- include/pybind11/eigen.h | 5 +++++ tests/test_builtin_casters.cpp | 9 +++++++-- tests/test_stl.cpp | 10 ++++++++-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a24ad6ab..ac6c536ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -911,7 +911,7 @@ jobs: - name: Configure C++11 # LTO leads to many undefined reference like # `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&) - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DDOWNLOAD_CATCH=ON -S . -B build + run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build - name: Build C++11 run: cmake --build build -j 2 @@ -929,7 +929,7 @@ jobs: run: git clean -fdx - name: Configure C++14 - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DDOWNLOAD_CATCH=ON -S . -B build2 + run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build2 - name: Build C++14 run: cmake --build build2 -j 2 @@ -947,7 +947,7 @@ jobs: run: git clean -fdx - name: Configure C++17 - run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DDOWNLOAD_CATCH=ON -S . -B build3 + run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DCMAKE_VERBOSE_MAKEFILE=ON -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -S . -B build3 - name: Build C++17 run: cmake --build build3 -j 2 diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index 4d221b3d7..831625229 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -27,6 +27,9 @@ # pragma warning(disable : 4127) // C4127: conditional expression is constant # pragma warning(disable : 5054) // https://github.com/pybind/pybind11/pull/3741 // C5054: operator '&': deprecated between enumerations of different types +#elif defined(__MINGW32__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include @@ -34,6 +37,8 @@ #if defined(_MSC_VER) # pragma warning(pop) +#elif defined(__MINGW32__) +# pragma GCC diagnostic pop #endif // Eigen prior to 3.2.7 doesn't have proper move constructors--but worse, some classes get implicit diff --git a/tests/test_builtin_casters.cpp b/tests/test_builtin_casters.cpp index 6529f47d0..6ff63edfc 100644 --- a/tests/test_builtin_casters.cpp +++ b/tests/test_builtin_casters.cpp @@ -266,9 +266,14 @@ TEST_SUBMODULE(builtin_casters, m) { }); m.def("lvalue_nested", []() -> const decltype(lvnested) & { return lvnested; }); - static std::pair int_string_pair{2, "items"}; m.def( - "int_string_pair", []() { return &int_string_pair; }, py::return_value_policy::reference); + "int_string_pair", + []() { + // Using no-destructor idiom to side-step warnings from overzealous compilers. + static auto *int_string_pair = new std::pair{2, "items"}; + return int_string_pair; + }, + py::return_value_policy::reference); // test_builtins_cast_return_none m.def("return_none_string", []() -> std::string * { return nullptr; }); diff --git a/tests/test_stl.cpp b/tests/test_stl.cpp index 38d32fda9..dcc92c3f0 100644 --- a/tests/test_stl.cpp +++ b/tests/test_stl.cpp @@ -176,9 +176,14 @@ TEST_SUBMODULE(stl, m) { m.def("load_bool_vector", [](const std::vector &v) { return v.at(0) == true && v.at(1) == false; }); // Unnumbered regression (caused by #936): pointers to stl containers aren't castable - static std::vector lvv{2}; m.def( - "cast_ptr_vector", []() { return &lvv; }, py::return_value_policy::reference); + "cast_ptr_vector", + []() { + // Using no-destructor idiom to side-step warnings from overzealous compilers. + static auto *v = new std::vector{2}; + return v; + }, + py::return_value_policy::reference); // test_deque m.def("cast_deque", []() { return std::deque{1}; }); @@ -237,6 +242,7 @@ TEST_SUBMODULE(stl, m) { lvn["b"].emplace_back(); // add a list lvn["b"].back().emplace_back(); // add an array lvn["b"].back().emplace_back(); // add another array + static std::vector lvv{2}; m.def("cast_lv_vector", []() -> const decltype(lvv) & { return lvv; }); m.def("cast_lv_array", []() -> const decltype(lva) & { return lva; }); m.def("cast_lv_map", []() -> const decltype(lvm) & { return lvm; }); From aa953710c180fb9da5178c47b4dadcad945119f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:18:42 -0400 Subject: [PATCH 5/9] [pre-commit.ci] pre-commit autoupdate (#4090) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v2.37.1 → v2.37.2](https://github.com/asottile/pyupgrade/compare/v2.37.1...v2.37.2) - [github.com/pre-commit/mirrors-mypy: v0.961 → v0.971](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.971) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc0df85f3..c2c098c5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: # Upgrade old Python syntax - repo: https://github.com/asottile/pyupgrade - rev: "v2.37.1" + rev: "v2.37.2" hooks: - id: pyupgrade args: [--py36-plus] @@ -123,7 +123,7 @@ repos: # Check static types with mypy - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v0.961" + rev: "v0.971" hooks: - id: mypy args: [] From f8e8403b858d11f3d2102e66c06178ab204fd3d6 Mon Sep 17 00:00:00 2001 From: Thomas Eding Date: Mon, 1 Aug 2022 11:31:31 -0700 Subject: [PATCH 6/9] Open pybind11 namespace with consistent visility. (#4098) --- docs/advanced/cast/custom.rst | 4 ++-- docs/advanced/cast/stl.rst | 6 +++--- docs/advanced/classes.rst | 4 ++-- docs/advanced/smart_ptrs.rst | 2 +- tests/test_custom_type_casters.cpp | 14 +++++++------- tests/test_smart_ptr.cpp | 4 ++-- tests/test_stl.cpp | 12 ++++++------ tests/test_tagbased_polymorphic.cpp | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/advanced/cast/custom.rst b/docs/advanced/cast/custom.rst index 1df4d3e14..8138cac61 100644 --- a/docs/advanced/cast/custom.rst +++ b/docs/advanced/cast/custom.rst @@ -38,7 +38,7 @@ type is explicitly allowed. .. code-block:: cpp - namespace pybind11 { namespace detail { + namespace PYBIND11_NAMESPACE { namespace detail { template <> struct type_caster { public: /** @@ -78,7 +78,7 @@ type is explicitly allowed. return PyLong_FromLong(src.long_value); } }; - }} // namespace pybind11::detail + }} // namespace PYBIND11_NAMESPACE::detail .. note:: diff --git a/docs/advanced/cast/stl.rst b/docs/advanced/cast/stl.rst index 109763f7a..03d49b295 100644 --- a/docs/advanced/cast/stl.rst +++ b/docs/advanced/cast/stl.rst @@ -42,7 +42,7 @@ types: .. code-block:: cpp // `boost::optional` as an example -- can be any `std::optional`-like container - namespace pybind11 { namespace detail { + namespace PYBIND11_NAMESPACE { namespace detail { template struct type_caster> : optional_caster> {}; }} @@ -54,7 +54,7 @@ for custom variant types: .. code-block:: cpp // `boost::variant` as an example -- can be any `std::variant`-like container - namespace pybind11 { namespace detail { + namespace PYBIND11_NAMESPACE { namespace detail { template struct type_caster> : variant_caster> {}; @@ -66,7 +66,7 @@ for custom variant types: return boost::apply_visitor(args...); } }; - }} // namespace pybind11::detail + }} // namespace PYBIND11_NAMESPACE::detail The ``visit_helper`` specialization is not required if your ``name::variant`` provides a ``name::visit()`` function. For any other function name, the specialization must be diff --git a/docs/advanced/classes.rst b/docs/advanced/classes.rst index 49ddf5c0b..01a490b72 100644 --- a/docs/advanced/classes.rst +++ b/docs/advanced/classes.rst @@ -1228,7 +1228,7 @@ whether a downcast is safe, you can proceed by specializing the std::string bark() const { return sound; } }; - namespace pybind11 { + namespace PYBIND11_NAMESPACE { template<> struct polymorphic_type_hook { static const void *get(const Pet *src, const std::type_info*& type) { // note that src may be nullptr @@ -1239,7 +1239,7 @@ whether a downcast is safe, you can proceed by specializing the return src; } }; - } // namespace pybind11 + } // namespace PYBIND11_NAMESPACE When pybind11 wants to convert a C++ pointer of type ``Base*`` to a Python object, it calls ``polymorphic_type_hook::get()`` to diff --git a/docs/advanced/smart_ptrs.rst b/docs/advanced/smart_ptrs.rst index 5a2220109..3c40ce123 100644 --- a/docs/advanced/smart_ptrs.rst +++ b/docs/advanced/smart_ptrs.rst @@ -157,7 +157,7 @@ specialized: PYBIND11_DECLARE_HOLDER_TYPE(T, SmartPtr); // Only needed if the type's `.get()` goes by another name - namespace pybind11 { namespace detail { + namespace PYBIND11_NAMESPACE { namespace detail { template struct holder_helper> { // <-- specialization static const T *get(const SmartPtr &p) { return p.getPointer(); } diff --git a/tests/test_custom_type_casters.cpp b/tests/test_custom_type_casters.cpp index 25540e368..b4af02a45 100644 --- a/tests/test_custom_type_casters.cpp +++ b/tests/test_custom_type_casters.cpp @@ -21,7 +21,7 @@ public: }; class ArgAlwaysConverts {}; -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template <> struct type_caster { @@ -74,7 +74,7 @@ public: } }; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE // test_custom_caster_destruction class DestructionTester { @@ -92,7 +92,7 @@ public: return *this; } }; -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template <> struct type_caster { @@ -104,7 +104,7 @@ struct type_caster { } }; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE // Define type caster outside of `pybind11::detail` and then alias it. namespace other_lib { @@ -112,7 +112,7 @@ struct MyType {}; // Corrupt `py` shorthand alias for surrounding context. namespace py {} // Corrupt unqualified relative `pybind11` namespace. -namespace pybind11 {} +namespace PYBIND11_NAMESPACE {} // Correct alias. namespace py_ = ::pybind11; // Define caster. This is effectively no-op, we only ensure it compiles and we @@ -127,12 +127,12 @@ struct my_caster { }; } // namespace other_lib // Effectively "alias" it into correct namespace (via inheritance). -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template <> struct type_caster : public other_lib::my_caster {}; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE TEST_SUBMODULE(custom_type_casters, m) { // test_custom_type_casters diff --git a/tests/test_smart_ptr.cpp b/tests/test_smart_ptr.cpp index 2c23a9a19..6d9efcedc 100644 --- a/tests/test_smart_ptr.cpp +++ b/tests/test_smart_ptr.cpp @@ -266,14 +266,14 @@ struct ElementList { // It is always possible to construct a ref from an Object* pointer without // possible inconsistencies, hence the 'true' argument at the end. // Make pybind11 aware of the non-standard getter member function -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template struct holder_helper> { static const T *get(const ref &p) { return p.get_ptr(); } }; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE // Make pybind aware of the ref-counted wrapper type (s): PYBIND11_DECLARE_HOLDER_TYPE(T, ref, true); diff --git a/tests/test_stl.cpp b/tests/test_stl.cpp index dcc92c3f0..d45465d68 100644 --- a/tests/test_stl.cpp +++ b/tests/test_stl.cpp @@ -23,7 +23,7 @@ #if defined(PYBIND11_TEST_BOOST) # include -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template struct type_caster> : optional_caster> {}; @@ -31,7 +31,7 @@ struct type_caster> : optional_caster> {}; template <> struct type_caster : void_caster {}; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE #endif // Test with `std::variant` in C++17 mode, or with `boost::variant` in C++11/14 @@ -43,7 +43,7 @@ using std::variant; # define PYBIND11_TEST_VARIANT 1 using boost::variant; -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template struct type_caster> : variant_caster> {}; @@ -56,7 +56,7 @@ struct visit_helper { } }; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE #endif PYBIND11_MAKE_OPAQUE(std::vector>); @@ -159,13 +159,13 @@ private: std::vector storage; }; -namespace pybind11 { +namespace PYBIND11_NAMESPACE { namespace detail { template struct type_caster> : optional_caster> {}; } // namespace detail -} // namespace pybind11 +} // namespace PYBIND11_NAMESPACE TEST_SUBMODULE(stl, m) { // test_vector diff --git a/tests/test_tagbased_polymorphic.cpp b/tests/test_tagbased_polymorphic.cpp index 2807e86ba..12ba6532f 100644 --- a/tests/test_tagbased_polymorphic.cpp +++ b/tests/test_tagbased_polymorphic.cpp @@ -117,7 +117,7 @@ std::string Animal::name_of_kind(Kind kind) { return raw_name; } -namespace pybind11 { +namespace PYBIND11_NAMESPACE { template struct polymorphic_type_hook::value>> { static const void *get(const itype *src, const std::type_info *&type) { @@ -125,7 +125,7 @@ struct polymorphic_type_hook(m, "Animal").def_readonly("name", &Animal::name); From 88a1bb926085dc2298cd7bbfc330f232362c793d Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Mon, 1 Aug 2022 15:48:44 -0400 Subject: [PATCH 7/9] chore: remove unnecessary temporary std::pair (#4103) --- include/pybind11/pybind11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index d61dcd5c7..c889dc416 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -2073,7 +2073,7 @@ struct enum_base { + "\" already exists!"); } - entries[name] = std::make_pair(value, doc); + entries[name] = pybind11::make_tuple(value, doc); m_base.attr(std::move(name)) = std::move(value); } From ba5ccd845a2261e538df651e3d528dc1bece094d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 11:38:07 -0400 Subject: [PATCH 8/9] [pre-commit.ci] pre-commit autoupdate (#4104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v2.37.2 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.37.2...v2.37.3) - [github.com/hadialqattan/pycln: v2.0.4 → v2.1.1](https://github.com/hadialqattan/pycln/compare/v2.0.4...v2.1.1) - [github.com/PyCQA/flake8: 4.0.1 → 5.0.2](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.2) * fix: minor touchups for flake8 Signed-off-by: Henry Schreiner Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner --- .pre-commit-config.yaml | 6 +++--- setup.cfg | 2 +- tests/test_exceptions.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2c098c5a..e41480d05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: # Upgrade old Python syntax - repo: https://github.com/asottile/pyupgrade - rev: "v2.37.2" + rev: "v2.37.3" hooks: - id: pyupgrade args: [--py36-plus] @@ -71,7 +71,7 @@ repos: # Autoremoves unused imports - repo: https://github.com/hadialqattan/pycln - rev: "v2.0.4" + rev: "v2.1.1" hooks: - id: pycln stages: [manual] @@ -99,7 +99,7 @@ repos: # Flake8 also supports pre-commit natively (same author) - repo: https://github.com/PyCQA/flake8 - rev: "4.0.1" + rev: "5.0.2" hooks: - id: flake8 exclude: ^(docs/.*|tools/.*)$ diff --git a/setup.cfg b/setup.cfg index 36fbfed4f..9af50ea48 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,5 +46,5 @@ zip_safe = False max-line-length = 120 show_source = True exclude = .git, __pycache__, build, dist, docs, tools, venv -extend-ignore = E203, E722, B950 +extend-ignore = E203, E722, B903, B950 extend-select = B9 diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 5e3beeedb..70b6ffea9 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -185,8 +185,8 @@ def test_custom(msg): with pytest.raises(m.MyException5) as excinfo: try: m.throws5() - except m.MyException5_1: - raise RuntimeError("Exception error: caught child from parent") + except m.MyException5_1 as err: + raise RuntimeError("Exception error: caught child from parent") from err assert msg(excinfo.value) == "this is a helper-defined translated exception" From 29f4940cd4aa4e954a16d2f20897b458e3098588 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 5 Aug 2022 08:05:40 -0700 Subject: [PATCH 9/9] Fix copy-paste oversight (#4118) --- .github/workflows/upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index a40a6c7d7..95ff4cb83 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -104,7 +104,7 @@ jobs: run: cmake --build build3 --target pytest - name: Interface test - run: cmake --build build2 --target test_cmake_build + run: cmake --build build3 --target test_cmake_build # This makes sure the setup_helpers module can build packages using # setuptools