Skip to content

Commit f6cd7a0

Browse files
vstinnerSeth Sims
authored andcommitted
bpo-40170: Use inline _PyType_HasFeature() function (pythonGH-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 7e87ccf commit f6cd7a0

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy