diff options
author | Peter Bierma <zintensitydev@gmail.com> | 2024-12-06 15:58:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-06 15:58:19 (GMT) |
commit | 12680ec5bd45c85b6daebe0739d30ef45f089efa (patch) | |
tree | a94a35fc4e7fbb5daf875c5142d50a89e595d957 /Objects | |
parent | a353455fca1b8f468ff3ffbb4b5e316510b4fd43 (diff) | |
download | cpython-12680ec5bd45c85b6daebe0739d30ef45f089efa.zip cpython-12680ec5bd45c85b6daebe0739d30ef45f089efa.tar.gz cpython-12680ec5bd45c85b6daebe0739d30ef45f089efa.tar.bz2 |
gh-127314: Don't mention the GIL when calling without a thread state on the free-threaded build (#127315)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/obmalloc.c | 7 |
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 } } |