Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfc6d74

Browse files
committed
Use GetAttrId directly. Proposed by Amaury.
1 parent f0b934b commit bfc6d74

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

Objects/typeobject.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6308,16 +6308,9 @@ supercheck(PyTypeObject *type, PyObject *obj)
63086308
}
63096309
else {
63106310
/* Try the slow way */
6311-
PyObject *class_str = NULL;
63126311
PyObject *class_attr;
63136312

6314-
class_str = _PyUnicode_FromId(&PyId___class__);
6315-
if (class_str == NULL)
6316-
return NULL;
6317-
6318-
class_attr = PyObject_GetAttr(obj, class_str);
6319-
Py_DECREF(class_str);
6320-
6313+
class_attr = _PyObject_GetAttrId(obj, &PyId___class__);
63216314
if (class_attr != NULL &&
63226315
PyType_Check(class_attr) &&
63236316
(PyTypeObject *)class_attr != Py_TYPE(obj))

0 commit comments

Comments
 (0)