summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-06-08 20:06:54 (GMT)
committerGitHub <noreply@github.com>2023-06-08 20:06:54 (GMT)
commit68dfa496278aa21585eb4654d5f7ef13ef76cb50 (patch)
tree3a3cd54110d87512915634682f18818577c57ffe /Python
parent4ff5690e591b7d11cf11e34bf61004e2ea58ab3c (diff)
downloadcpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.zip
cpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.tar.gz
cpython-68dfa496278aa21585eb4654d5f7ef13ef76cb50.tar.bz2
gh-100227: Lock Around Modification of the Global Allocators State (gh-105516)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 3ee99a4..fb95825 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -380,7 +380,7 @@ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
static const _PyRuntimeState initial = _PyRuntimeState_INIT(_PyRuntime);
_Py_COMP_DIAG_POP
-#define NUMLOCKS 7
+#define NUMLOCKS 8
#define LOCKS_INIT(runtime) \
{ \
&(runtime)->interpreters.mutex, \
@@ -390,6 +390,7 @@ _Py_COMP_DIAG_POP
&(runtime)->imports.extensions.mutex, \
&(runtime)->atexit.mutex, \
&(runtime)->audit_hooks.mutex, \
+ &(runtime)->allocators.mutex, \
}
static int