diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index e1175150264..d54108052db 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -2327,11 +2327,11 @@ inline std::pair all_type_info_get_cache(PyTypeObject *type) { auto res = with_internals([type](internals &internals) { auto ins = internals - .registered_types_py + .registered_types_py #ifdef __cpp_lib_unordered_map_try_emplace - .try_emplace(type); + .try_emplace(type); #else - .emplace(type, std::vector()); + .emplace(type, std::vector()); #endif if (ins.second) { // In free-threading this method should be called diff --git a/tests/pybind11_tests.h b/tests/pybind11_tests.h index 2da130fdabb..4c8c2e60f91 100644 --- a/tests/pybind11_tests.h +++ b/tests/pybind11_tests.h @@ -97,25 +97,22 @@ void ignoreOldStyleInitWarnings(F &&body) { py::dict(py::arg("body") = py::cpp_function(body))); } - class PyTestContext { public: PyTestContext() = delete; PyTestContext(const PyTestContext &) = delete; PyTestContext(PyTestContext &&) = delete; - static PyTestContext *createNewContextForInit() { - return new PyTestContext("new-context"); - } + static PyTestContext *createNewContextForInit() { return new PyTestContext("new-context"); } pybind11::object contextEnter() { py::object contextObj = py::cast(*this); return contextObj; } - void contextExit(const pybind11::object &/*excType*/, - const pybind11::object &/*excVal*/, - const pybind11::object &/*excTb*/) {} + void contextExit(const pybind11::object & /*excType*/, + const pybind11::object & /*excVal*/, + const pybind11::object & /*excTb*/) {} private: PyTestContext(std::string context) : context(context) {} std::string context; -}; \ No newline at end of file +}; diff --git a/tests/test_class.py b/tests/test_class.py index d3e9e07c1bf..b95932069ec 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -519,6 +519,7 @@ def test_all_type_info_multithreaded(): # "instance allocation failed: new instance has no pybind11-registered base types"); # } import threading + from pybind11_tests import TestContext class Context(TestContext):