@@ -512,7 +512,8 @@ specialize_module_load_attr(
512512 SPEC_FAIL_OUT_OF_RANGE );
513513 return -1 ;
514514 }
515- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (dict -> ma_keys );
515+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (
516+ _PyInterpreterState_GET (), dict -> ma_keys );
516517 if (keys_version == 0 ) {
517518 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OUT_OF_VERSIONS );
518519 return -1 ;
@@ -1063,7 +1064,8 @@ PyObject *descr, DescriptorClassification kind)
10631064 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_ATTR_SHADOWED );
10641065 return 0 ;
10651066 }
1066- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (keys );
1067+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (
1068+ _PyInterpreterState_GET (), keys );
10671069 if (keys_version == 0 ) {
10681070 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OUT_OF_VERSIONS );
10691071 return 0 ;
@@ -1134,12 +1136,14 @@ _Py_Specialize_LoadGlobal(
11341136 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_EXPECTED_ERROR );
11351137 goto fail ;
11361138 }
1139+ PyInterpreterState * interp = _PyInterpreterState_GET ();
11371140 if (index != DKIX_EMPTY ) {
11381141 if (index != (uint16_t )index ) {
11391142 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
11401143 goto fail ;
11411144 }
1142- uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (globals_keys );
1145+ uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState (
1146+ interp , globals_keys );
11431147 if (keys_version == 0 ) {
11441148 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
11451149 goto fail ;
@@ -1167,12 +1171,14 @@ _Py_Specialize_LoadGlobal(
11671171 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_OUT_OF_RANGE );
11681172 goto fail ;
11691173 }
1170- uint32_t globals_version = _PyDictKeys_GetVersionForCurrentState (globals_keys );
1174+ uint32_t globals_version = _PyDictKeys_GetVersionForCurrentState (
1175+ interp , globals_keys );
11711176 if (globals_version == 0 ) {
11721177 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
11731178 goto fail ;
11741179 }
1175- uint32_t builtins_version = _PyDictKeys_GetVersionForCurrentState (builtin_keys );
1180+ uint32_t builtins_version = _PyDictKeys_GetVersionForCurrentState (
1181+ interp , builtin_keys );
11761182 if (builtins_version == 0 ) {
11771183 SPECIALIZATION_FAIL (LOAD_GLOBAL , SPEC_FAIL_OUT_OF_VERSIONS );
11781184 goto fail ;
0 commit comments