@@ -909,22 +909,20 @@ analyze_descriptor(PyTypeObject *type, PyObject *name, PyObject **descr, unsigne
909909 PyInterpreterState * interp = _PyInterpreterState_GET ();
910910 bool has_custom_getattribute = getattribute != NULL &&
911911 getattribute != interp -> callable_cache .object__getattribute__ ;
912- PyObject * getattr = _PyType_LookupRef (type , & _Py_ID (__getattr__ ));
912+ PyObject * getattr = _PyType_Lookup (type , & _Py_ID (__getattr__ ));
913913 has_getattr = getattr != NULL ;
914914 if (has_custom_getattribute ) {
915915 if (getattro_slot == _Py_slot_tp_getattro &&
916916 !has_getattr &&
917917 Py_IS_TYPE (getattribute , & PyFunction_Type )) {
918918 * descr = getattribute ;
919- assert (getattr == NULL );
920919 * tp_version = ga_version ;
921920 return GETATTRIBUTE_IS_PYTHON_FUNCTION ;
922921 }
923922 /* Potentially both __getattr__ and __getattribute__ are set.
924923 Too complicated */
925924 * descr = NULL ;
926925 Py_XDECREF (getattribute );
927- Py_XDECREF (getattr );
928926 return GETSET_OVERRIDDEN ;
929927 }
930928 /* Potentially has __getattr__ but no custom __getattribute__.
@@ -934,7 +932,6 @@ analyze_descriptor(PyTypeObject *type, PyObject *name, PyObject **descr, unsigne
934932 raised. This means some specializations, e.g. specializing
935933 for property() isn't safe.
936934 */
937- Py_XDECREF (getattr );
938935 Py_XDECREF (getattribute );
939936 }
940937 else {
@@ -1289,7 +1286,7 @@ specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject* na
12891286 uint32_t shared_keys_version = 0 ;
12901287 bool shadow = instance_has_key (owner , name , & shared_keys_version );
12911288 PyObject * descr = NULL ;
1292- unsigned int tp_version ;
1289+ unsigned int tp_version = 0 ;
12931290 PyTypeObject * type = Py_TYPE (owner );
12941291 DescriptorClassification kind = analyze_descriptor (type , name , & descr , & tp_version , 0 );
12951292 int result = do_specialize_instance_load_attr (owner , instr , name , shadow , shared_keys_version , kind , descr , tp_version );
@@ -1480,7 +1477,7 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
14801477 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_ATTR_METACLASS_OVERRIDDEN );
14811478 return -1 ;
14821479 }
1483- unsigned int meta_version ;
1480+ unsigned int meta_version = 0 ;
14841481 PyObject * metadescriptor = _PyType_LookupRefAndVersion (Py_TYPE (cls ), name , & meta_version );
14851482 DescriptorClassification metakind = classify_descriptor (metadescriptor , false);
14861483 Py_XDECREF (metadescriptor );
@@ -1498,7 +1495,7 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
14981495 }
14991496 PyObject * descr = NULL ;
15001497 DescriptorClassification kind = 0 ;
1501- unsigned int tp_version ;
1498+ unsigned int tp_version = 0 ;
15021499 kind = analyze_descriptor (cls , name , & descr , & tp_version , 0 );
15031500 if (tp_version == 0 ) {
15041501 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OUT_OF_VERSIONS );
0 commit comments