New submission from STINNER Victor <vstin...@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
messages: 370572
nosy: vstinner
priority: normal
severity: normal
status: open
title: Disallow calling PyDict_GetItem() with the GIL released
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40839>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to