Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-40170: Use inline _PyType_HasFeature() function
Use _PyType_HasFeature() in the _io module and in structseq
implementation. Replace PyType_HasFeature() opaque function call with
_PyType_HasFeature() inlined function.
  • Loading branch information
vstinner committed Sep 23, 2020
commit 3e51a047ff766c3c9536fd7fb8f57f9d0b871577
3 changes: 2 additions & 1 deletion Modules/_io/iobase.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,9 @@ iobase_dealloc(iobase *self)
if (_PyIOBase_finalize((PyObject *) self) < 0) {
/* When called from a heap type's dealloc, the type will be
decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */
if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE))
if (_PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) {
Py_INCREF(Py_TYPE(self));
}
return;
}
_PyObject_GC_UNTRACK(self);
Expand Down
2 changes: 1 addition & 1 deletion Objects/structseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ structseq_dealloc(PyStructSequence *obj)
Py_XDECREF(obj->ob_item[i]);
}
PyObject_GC_Del(obj);
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
if (_PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE)) {
Py_DECREF(tp);
}
}
Expand Down