mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)
https://github.com/python/cpython/issues/100227
This commit is contained in:
parent
66ff374d4f
commit
5e5acd291f
5 changed files with 23 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue