File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -324,8 +324,8 @@ PYBIND11_WARNING_POP
324
324
#endif
325
325
326
326
// 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)
329
329
# define PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
330
330
#endif
331
331
Original file line number Diff line number Diff line change @@ -303,7 +303,12 @@ class handle : public detail::object_api<handle> {
303
303
stderr,
304
304
" %s is being called while the GIL is either not held or invalid. Please see "
305
305
" 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." ,
307
312
function_name.c_str ());
308
313
fflush (stderr);
309
314
if (Py_TYPE (m_ptr)->tp_name != nullptr ) {
You can’t perform that action at this time.
0 commit comments