mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-38733: PyErr_Occurred() caller must hold the GIL (GH-17080)
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test. Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case. _Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.
This commit is contained in:
parent
991b02dc87
commit
d12d0e7c0f
5 changed files with 12 additions and 7 deletions
|
|
@ -2313,12 +2313,13 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes)
|
|||
return data;
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
_PyMem_DebugCheckGIL(void)
|
||||
{
|
||||
if (!PyGILState_Check())
|
||||
if (!PyGILState_Check()) {
|
||||
Py_FatalError("Python memory allocator called "
|
||||
"without holding the GIL");
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue