File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -413,30 +413,18 @@ loop_has_instance_call_soon_shadow(PyObject *loop)
413413 // Respect instance-level monkeypatching such as:
414414 // loop.call_soon = custom_call_soon
415415 // These must keep using the public slow path.
416- PyTypeObject * loop_type = Py_TYPE (loop );
417416 PyObject * attr = NULL ;
418-
419- if ((loop_type -> tp_flags & Py_TPFLAGS_INLINE_VALUES ) &&
420- _PyObject_TryGetInstanceAttribute (loop , & _Py_ID (call_soon ), & attr )) {
421- int has_shadow = attr != NULL ;
422- Py_XDECREF (attr );
423- return has_shadow ;
424- }
425-
426- PyObject * dict ;
427- if (loop_type -> tp_flags & Py_TPFLAGS_MANAGED_DICT ) {
428- dict = (PyObject * )_PyObject_GetManagedDict (loop );
429- }
430- else {
431- PyObject * * dictptr = _PyObject_ComputedDictPointer (loop );
432- dict = dictptr != NULL ? FT_ATOMIC_LOAD_PTR_ACQUIRE (* dictptr ) : NULL ;
433- }
434-
417+ PyObject * dict = PyObject_GenericGetDict (loop , NULL );
435418 if (dict == NULL ) {
436- return 0 ;
419+ if (PyErr_ExceptionMatches (PyExc_AttributeError )) {
420+ PyErr_Clear ();
421+ return 0 ;
422+ }
423+ return -1 ;
437424 }
438425
439426 int rc = PyDict_GetItemRef (dict , & _Py_ID (call_soon ), & attr );
427+ Py_DECREF (dict );
440428 if (rc < 0 ) {
441429 return -1 ;
442430 }
You can’t perform that action at this time.
0 commit comments