Skip to content

Commit 97d15ae

Browse files
authored
bpo-40170: Use inline _PyType_HasFeature() function (GH-22375)
Use _PyType_HasFeature() in the _io module and in structseq implementation. Replace PyType_HasFeature() opaque function call with _PyType_HasFeature() inlined function.
1 parent b7d8d8d commit 97d15ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Modules/_io/iobase.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ iobase_dealloc(iobase *self)
349349
if (_PyIOBase_finalize((PyObject *) self) < 0) {
350350
/* When called from a heap type's dealloc, the type will be
351351
decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */
352-
if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE))
352+
if (_PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) {
353353
Py_INCREF(Py_TYPE(self));
354+
}
354355
return;
355356
}
356357
_PyObject_GC_UNTRACK(self);

Objects/structseq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ structseq_dealloc(PyStructSequence *obj)
9494
Py_XDECREF(obj->ob_item[i]);
9595
}
9696
PyObject_GC_Del(obj);
97-
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
97+
if (_PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE)) {
9898
Py_DECREF(tp);
9999
}
100100
}

0 commit comments

Comments
 (0)