[New-bugs-announce] [issue40839] Disallow calling PyDict_GetItem() with the GIL released
report at bugs.python.org
Mon Jun 1 14:46:37 EDT 2020
New submission from STINNER Victor <vstinner at python.org>:
For historical reasons, it was allowed to call the PyDict_GetItem() function with the GIL released.
I propose to change PyDict_GetItem() to fail with a fatal error if it's called with the GIL released.
To help C extension modules authors, I propose to keep a check at the runtime even in release build. Later, we may drop this check in release mode and only keep it in debug mode.
In Python 3.8 and then 3.9, some functions started to crash when called without holding the GIL. It caused some bad surprises to C extension modules authors. Example: gdb developers with bpo-40826. In my opinion, holding the GIL was always required even if it is not very explicit in the documentation of the C API (only the documentation of few functions are explicit about the GIL).
components: C API
title: Disallow calling PyDict_GetItem() with the GIL released
versions: Python 3.10
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce