@@ -389,6 +389,7 @@ miss_counter_start(void) {
389
389
#define SPEC_FAIL_ATTR_HAS_MANAGED_DICT 25
390
390
#define SPEC_FAIL_ATTR_INSTANCE_ATTRIBUTE 26
391
391
#define SPEC_FAIL_ATTR_METACLASS_ATTRIBUTE 27
392
+ #define SPEC_FAIL_ATTR_PROPERTY_NOT_PY_FUNCTION 28
392
393
393
394
/* Binary subscr and store subscr */
394
395
@@ -594,7 +595,9 @@ analyze_descriptor(PyTypeObject *type, PyObject *name, PyObject **descr, int sto
594
595
getattribute != interp -> callable_cache .object__getattribute__ ;
595
596
has_getattr = _PyType_Lookup (type , & _Py_ID (__getattr__ )) != NULL ;
596
597
if (has_custom_getattribute ) {
597
- if (!has_getattr && Py_IS_TYPE (getattribute , & PyFunction_Type )) {
598
+ if (getattro_slot == _Py_slot_tp_getattro &&
599
+ !has_getattr &&
600
+ Py_IS_TYPE (getattribute , & PyFunction_Type )) {
598
601
* descr = getattribute ;
599
602
return GETATTRIBUTE_IS_PYTHON_FUNCTION ;
600
603
}
@@ -772,7 +775,7 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
772
775
goto fail ;
773
776
}
774
777
if (!Py_IS_TYPE (fget , & PyFunction_Type )) {
775
- SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_NOT_PY_FUNCTION );
778
+ SPECIALIZATION_FAIL (LOAD_ATTR , SPEC_FAIL_ATTR_PROPERTY_NOT_PY_FUNCTION );
776
779
goto fail ;
777
780
}
778
781
uint32_t version = function_check_args (fget , 1 , LOAD_ATTR ) &&
0 commit comments