Skip to content

Commit 55ffc32

Browse files
committed
Improve obmalloc error message.
1 parent 2f53c94 commit 55ffc32

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Objects/obmalloc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,9 +2910,16 @@ static inline void
29102910
_PyMem_DebugCheckGIL(const char *func)
29112911
{
29122912
if (!PyGILState_Check()) {
2913+
#ifndef Py_GIL_DISABLED
29132914
_Py_FatalErrorFunc(func,
29142915
"Python memory allocator called "
29152916
"without holding the GIL");
2917+
#else
2918+
_Py_FatalErrorFunc(func,
2919+
"Python memory allocator called "
2920+
"without an active thread state. "
2921+
"(Are you trying to call it inside of a Py_BEGIN_ALLOW_THREADS block?)");
2922+
#endif
29162923
}
29172924
}
29182925

0 commit comments

Comments
 (0)