@@ -511,7 +511,6 @@ specialize_module_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
511511{
512512 _PyAttrCache * cache = (_PyAttrCache * )(instr + 1 );
513513 PyModuleObject * m = (PyModuleObject * )owner ;
514- PyObject * value = NULL ;
515514 assert ((owner -> ob_type -> tp_flags & Py_TPFLAGS_MANAGED_DICT ) == 0 );
516515 PyDictObject * dict = (PyDictObject * )m -> md_dict ;
517516 if (dict == NULL ) {
@@ -522,14 +521,13 @@ specialize_module_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
522521 SPECIALIZATION_FAIL (opcode , SPEC_FAIL_ATTR_NON_STRING_OR_SPLIT );
523522 return -1 ;
524523 }
525- Py_ssize_t index = _PyDict_GetItemHint (dict , & _Py_ID (__getattr__ ), -1 ,
526- & value );
524+ Py_ssize_t index = _PyDict_LookupIndex (dict , & _Py_ID (__getattr__ ));
527525 assert (index != DKIX_ERROR );
528526 if (index != DKIX_EMPTY ) {
529527 SPECIALIZATION_FAIL (opcode , SPEC_FAIL_ATTR_MODULE_ATTR_NOT_FOUND );
530528 return -1 ;
531529 }
532- index = _PyDict_GetItemHint (dict , name , -1 , & value );
530+ index = _PyDict_LookupIndex (dict , name );
533531 assert (index != DKIX_ERROR );
534532 if (index != (uint16_t )index ) {
535533 SPECIALIZATION_FAIL (opcode , SPEC_FAIL_OUT_OF_RANGE );
@@ -703,14 +701,13 @@ specialize_dict_access(
703701 return 0 ;
704702 }
705703 // We found an instance with a __dict__.
706- PyObject * value = NULL ;
707- Py_ssize_t hint =
708- _PyDict_GetItemHint (dict , name , -1 , & value );
709- if (hint != (uint16_t )hint ) {
704+ Py_ssize_t index =
705+ _PyDict_LookupIndex (dict , name );
706+ if (index != (uint16_t )index ) {
710707 SPECIALIZATION_FAIL (base_op , SPEC_FAIL_OUT_OF_RANGE );
711708 return 0 ;
712709 }
713- cache -> index = (uint16_t )hint ;
710+ cache -> index = (uint16_t )index ;
714711 write_u32 (cache -> version , type -> tp_version_tag );
715712 _Py_SET_OPCODE (* instr , hint_op );
716713 }
0 commit comments