@@ -923,6 +923,7 @@ analyze_descriptor_load(PyTypeObject *type, PyObject *name, PyObject **descr, un
923923 /* Normal attribute lookup; */
924924 has_getattr = false;
925925 }
926+ // TODO(regions): xFrednet: Support slots getter and setter
926927 else if (getattro_slot == _Py_slot_tp_getattr_hook ||
927928 getattro_slot == _Py_slot_tp_getattro ) {
928929 /* One or both of __getattribute__ or __getattr__ may have been
@@ -944,7 +945,7 @@ analyze_descriptor_load(PyTypeObject *type, PyObject *name, PyObject **descr, un
944945 }
945946 /* Potentially both __getattr__ and __getattribute__ are set.
946947 Too complicated */
947- Py_DECREF (getattribute );
948+ PyRegion_CLEARLOCAL (getattribute );
948949 * descr = NULL ;
949950 * tp_version = ga_version ;
950951 return GETSET_OVERRIDDEN ;
@@ -956,7 +957,7 @@ analyze_descriptor_load(PyTypeObject *type, PyObject *name, PyObject **descr, un
956957 raised. This means some specializations, e.g. specializing
957958 for property() isn't safe.
958959 */
959- Py_XDECREF (getattribute );
960+ PyRegion_CLEARLOCAL (getattribute );
960961 }
961962 else {
962963 * descr = NULL ;
@@ -1337,7 +1338,7 @@ specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject* na
13371338 PyTypeObject * type = Py_TYPE (owner );
13381339 DescriptorClassification kind = analyze_descriptor_load (type , name , & descr , & tp_version );
13391340 int result = do_specialize_instance_load_attr (owner , instr , name , shadow , shared_keys_version , kind , descr , tp_version );
1340- Py_XDECREF (descr );
1341+ PyRegion_CLEARLOCAL (descr );
13411342 return result ;
13421343}
13431344
@@ -1523,7 +1524,7 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
15231524 unsigned int meta_version = 0 ;
15241525 PyObject * metadescriptor = _PyType_LookupRefAndVersion (Py_TYPE (cls ), name , & meta_version );
15251526 DescriptorClassification metakind = classify_descriptor (metadescriptor , false);
1526- Py_XDECREF (metadescriptor );
1527+ PyRegion_CLEARLOCAL (metadescriptor );
15271528 switch (metakind ) {
15281529 case METHOD :
15291530 case NON_DESCRIPTOR :
@@ -1542,15 +1543,15 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
15421543 kind = analyze_descriptor_load (cls , name , & descr , & tp_version );
15431544 if (tp_version == 0 ) {
15441545 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OUT_OF_VERSIONS );
1545- Py_XDECREF (descr );
1546+ PyRegion_CLEARLOCAL (descr );
15461547 return -1 ;
15471548 }
15481549 bool metaclass_check = false;
15491550 if ((Py_TYPE (cls )-> tp_flags & Py_TPFLAGS_IMMUTABLETYPE ) == 0 ) {
15501551 metaclass_check = true;
15511552 if (meta_version == 0 ) {
15521553 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_OUT_OF_VERSIONS );
1553- Py_XDECREF (descr );
1554+ PyRegion_CLEARLOCAL (descr );
15541555 return -1 ;
15551556 }
15561557 }
@@ -1573,17 +1574,17 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
15731574 else {
15741575 specialize (instr , LOAD_ATTR_CLASS );
15751576 }
1576- Py_XDECREF (descr );
1577+ PyRegion_CLEARLOCAL (descr );
15771578 return 0 ;
15781579#ifdef Py_STATS
15791580 case ABSENT :
15801581 SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_EXPECTED_ERROR );
1581- Py_XDECREF (descr );
1582+ PyRegion_CLEARLOCAL (descr );
15821583 return -1 ;
15831584#endif
15841585 default :
15851586 SPECIALIZATION_FAIL (LOAD_ATTR , load_attr_fail_kind (kind ));
1586- Py_XDECREF (descr );
1587+ PyRegion_CLEARLOCAL (descr );
15871588 return -1 ;
15881589 }
15891590}
0 commit comments