summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-08 22:35:53 (GMT)
committerGitHub <noreply@github.com>2023-06-08 22:35:53 (GMT)
commit77c03a3b7241a8476665db89f058bb6eb15f8abb (patch)
treec345b60f5be8dc9a610f69b9d314dc3f472e9f92 /Python
parent3eccd95f56f2c360ec39a37e15ce7e9c3f134528 (diff)
downloadcpython-77c03a3b7241a8476665db89f058bb6eb15f8abb.zip
cpython-77c03a3b7241a8476665db89f058bb6eb15f8abb.tar.gz
cpython-77c03a3b7241a8476665db89f058bb6eb15f8abb.tar.bz2
[3.12] gh-100227: Lock Around Modification of the Global Allocators State (gh-105516) (gh-105532)
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. (cherry picked from commit 68dfa496278aa21585eb4654d5f7ef13ef76cb50) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
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 14ae165..d63a873 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