diff options
author | 2019-11-07 12:42:07 +0100 | |
---|---|---|
committer | 2019-11-07 12:42:07 +0100 | |
commit | d12d0e7c0fe2b49c40ac4d66365147c619d6c475 (patch) | |
tree | 9ccd0a4fdb77f4c9ee169c9f775eab2de78bffd0 /Objects/obmalloc.c | |
parent | update a deprecated assert in logging tests (GH-17079) (diff) | |
download | cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.tar.gz cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.tar.bz2 cpython-d12d0e7c0fe2b49c40ac4d66365147c619d6c475.zip |
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.
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r-- | Objects/obmalloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 50701dbd384..722e91e3db4 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -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 * |