summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-03-09 01:04:16 (GMT)
committerGitHub <noreply@github.com>2023-03-09 01:04:16 (GMT)
commit5e5acd291f4387876afc641163e9f8ae5c65086c (patch)
treeb1ae91adf3e2ea87b110c6f1d95b265c084d7201 /Python
parent66ff374d4f353ae427c148d2a1d141d223303a82 (diff)
downloadcpython-5e5acd291f4387876afc641163e9f8ae5c65086c.zip
cpython-5e5acd291f4387876afc641163e9f8ae5c65086c.tar.gz
cpython-5e5acd291f4387876afc641163e9f8ae5c65086c.tar.bz2
gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)
https://github.com/python/cpython/issues/100227
Diffstat (limited to 'Python')
-rw-r--r--Python/specialize.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 3405d2b..0a7af89 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -512,7 +512,8 @@ specialize_module_load_attr(
SPEC_FAIL_OUT_OF_RANGE);
return -1;
}
- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(dict->ma_keys);
+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(
+ _PyInterpreterState_GET(), dict->ma_keys);
if (keys_version == 0) {
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
return -1;
@@ -1063,7 +1064,8 @@ PyObject *descr, DescriptorClassification kind)
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_SHADOWED);
return 0;
}
- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(keys);
+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(
+ _PyInterpreterState_GET(), keys);
if (keys_version == 0) {
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
return 0;
@@ -1134,12 +1136,14 @@ _Py_Specialize_LoadGlobal(
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_EXPECTED_ERROR);
goto fail;
}
+ PyInterpreterState *interp = _PyInterpreterState_GET();
if (index != DKIX_EMPTY) {
if (index != (uint16_t)index) {
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_OUT_OF_RANGE);
goto fail;
}
- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(globals_keys);
+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState(
+ interp, globals_keys);
if (keys_version == 0) {
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
@@ -1167,12 +1171,14 @@ _Py_Specialize_LoadGlobal(
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_OUT_OF_RANGE);
goto fail;
}
- uint32_t globals_version = _PyDictKeys_GetVersionForCurrentState(globals_keys);
+ uint32_t globals_version = _PyDictKeys_GetVersionForCurrentState(
+ interp, globals_keys);
if (globals_version == 0) {
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
- uint32_t builtins_version = _PyDictKeys_GetVersionForCurrentState(builtin_keys);
+ uint32_t builtins_version = _PyDictKeys_GetVersionForCurrentState(
+ interp, builtin_keys);
if (builtins_version == 0) {
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;