summaryrefslogtreecommitdiffstats
path: root/Objects/obmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r--Objects/obmalloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 2cc0377..b103deb 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -2910,9 +2910,16 @@ static inline void
_PyMem_DebugCheckGIL(const char *func)
{
if (!PyGILState_Check()) {
+#ifndef Py_GIL_DISABLED
_Py_FatalErrorFunc(func,
"Python memory allocator called "
"without holding the GIL");
+#else
+ _Py_FatalErrorFunc(func,
+ "Python memory allocator called "
+ "without an active thread state. "
+ "Are you trying to call it inside of a Py_BEGIN_ALLOW_THREADS block?");
+#endif
}
}