From ec31025d9c747786f1ecb5c2da4c8f313dcbe8a1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Oct 2022 02:46:48 -0700 Subject: [PATCH] Revert "Temporarily pull in snapshot of PR #4246" This reverts commit 23ac16e859150f27fda25ca865cabcb4444e0770. --- include/pybind11/detail/common.h | 9 --------- include/pybind11/pytypes.h | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 4be11fa3403..a3e0bc9b37f 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -265,15 +265,6 @@ # define PYBIND11_HAS_U8STRING #endif -// See description of PR #4246: -#if !defined(NDEBUG) && !defined(PY_ASSERT_GIL_HELD_INCREF_DECREF) \ - && !(defined(PYPY_VERSION) \ - && defined(_MSC_VER)) /* PyPy Windows: pytest hangs indefinitely at the end of the \ - process (see PR #4268) */ \ - && !defined(PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF) -# define PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF -#endif - // #define PYBIND11_STR_LEGACY_PERMISSIVE // If DEFINED, pybind11::str can hold PyUnicodeObject or PyBytesObject // (probably surprising and never documented, but this was the diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index 4ef0819a6f4..37fc49a0e1f 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -246,11 +246,6 @@ class handle : public detail::object_api { const handle &inc_ref() const & { #ifdef PYBIND11_HANDLE_REF_DEBUG inc_ref_counter(1); -#endif -#if defined(PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF) - if (m_ptr != nullptr && !PyGILState_Check()) { - throw std::runtime_error("pybind11::handle::inc_ref() PyGILState_Check() failure."); - } #endif Py_XINCREF(m_ptr); return *this; @@ -262,11 +257,6 @@ class handle : public detail::object_api { this function automatically. Returns a reference to itself. \endrst */ const handle &dec_ref() const & { -#if defined(PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF) - if (m_ptr != nullptr && !PyGILState_Check()) { - throw std::runtime_error("pybind11::handle::dec_ref() PyGILState_Check() failure."); - } -#endif Py_XDECREF(m_ptr); return *this; }