File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -324,8 +324,8 @@ PYBIND11_WARNING_POP
324324#endif
325325
326326// See description of PR #4246:
327- #if !defined(NDEBUG ) && !defined(PY_ASSERT_GIL_HELD_INCREF_DECREF) && !defined(PYPY_VERSION) \
328- && !defined (PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF)
327+ #if !defined(PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF ) && !defined(NDEBUG) \
328+ && !defined (PYPY_VERSION) && ! defined ( PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF)
329329# define PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
330330#endif
331331
Original file line number Diff line number Diff line change @@ -303,7 +303,12 @@ class handle : public detail::object_api<handle> {
303303 stderr,
304304 " %s is being called while the GIL is either not held or invalid. Please see "
305305 " https://pybind11.readthedocs.io/en/stable/advanced/"
306- " misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.\n " ,
306+ " misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.\n "
307+ " If you are convinced there is no bug in your code, you can #define "
308+ " PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF"
309+ " to disable this check. In that case you have to ensure this #define is consistently "
310+ " used for all translation units linked into a given pybind11 extension, otherwise "
311+ " there will be ODR violations." ,
307312 function_name.c_str ());
308313 fflush (stderr);
309314 if (Py_TYPE (m_ptr)->tp_name != nullptr ) {
You can’t perform that action at this time.
0 commit comments