Closed
Description
Feature or enhancement
The warnings
implementation is split between Python (warnings.py
) and C (_warnings.c
). There are a few bits of code in the C module that are not thread-safe without the GIL:
The Py_SETREF
calls are not thread-safe if concurrent writers try to overwrite the same field (e.g., st->once_registry
). We can probably use critical sections to make it thread-safe.
get_once_registry
:
Line 259 in df4784b
get_default_action
:
Line 290 in df4784b
get_filter
:
Line 315 in df4784b
Some uses of borrowed references are likely not thread-safe
_PyDict_GetItemWithError
(replace withPyDict_GetItemRef
?)