We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26ff32b commit 63b9772Copy full SHA for 63b9772
Include/internal/pycore_pystate.h
@@ -190,10 +190,17 @@ static inline void
190
_Py_EnsureFuncTstateNotNULL(const char *func, PyThreadState *tstate)
191
{
192
if (tstate == NULL) {
193
+#ifndef Py_GIL_DISABLED
194
_Py_FatalErrorFunc(func,
195
"the function must be called with the GIL held, "
196
"after Python initialization and before Python finalization, "
197
"but the GIL is released (the current Python thread state is NULL)");
198
+#else
199
+ _Py_FatalErrorFunc(func,
200
+ "the function must be called with an active thread state, "
201
+ "after Python initialization and before Python finalization, but it is NULL "
202
+ "(are you trying to call the C API inside of a Py_BEGIN_ALLOW_THREADS block?)");
203
+#endif
204
}
205
206
0 commit comments