File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -8257,17 +8257,22 @@ _Py_slot_tp_getattr_hook(PyObject *self, PyObject *name)
8257
8257
if (getattribute == NULL ||
8258
8258
(Py_IS_TYPE (getattribute , & PyWrapperDescr_Type ) &&
8259
8259
((PyWrapperDescrObject * )getattribute )-> d_wrapped ==
8260
- (void * )PyObject_GenericGetAttr ))
8261
- res = PyObject_GenericGetAttr (self , name );
8262
- else {
8260
+ (void * )PyObject_GenericGetAttr )) {
8261
+ res = _PyObject_GenericGetAttrWithDict (self , name , NULL , 1 );
8262
+ /* if no error has occureed, then it must be suppressed by us */
8263
+ if (res == NULL && !PyErr_Occurred ()) {
8264
+ res = call_attribute (self , getattr , name );
8265
+ }
8266
+ } else {
8263
8267
Py_INCREF (getattribute );
8264
8268
res = call_attribute (self , getattribute , name );
8265
8269
Py_DECREF (getattribute );
8270
+ if (res == NULL && PyErr_ExceptionMatches (PyExc_AttributeError )) {
8271
+ PyErr_Clear ();
8272
+ res = call_attribute (self , getattr , name );
8273
+ }
8266
8274
}
8267
- if (res == NULL && PyErr_ExceptionMatches (PyExc_AttributeError )) {
8268
- PyErr_Clear ();
8269
- res = call_attribute (self , getattr , name );
8270
- }
8275
+
8271
8276
Py_DECREF (getattr );
8272
8277
return res ;
8273
8278
}
You can’t perform that action at this time.
0 commit comments