Revert "bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)" (GH-21390)
This partially reverts commit 45ec5b99ae
.
This commit is contained in:
parent
aebc049557
commit
b26a0db8ea
|
@ -637,8 +637,16 @@ times.
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
|
PyType_HasFeature(PyTypeObject *type, unsigned long feature)
|
||||||
return ((PyType_GetFlags(type) & feature) != 0);
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
#ifdef Py_LIMITED_API
|
||||||
|
// PyTypeObject is opaque in the limited C API
|
||||||
|
flags = PyType_GetFlags(type);
|
||||||
|
#else
|
||||||
|
flags = type->tp_flags;
|
||||||
|
#endif
|
||||||
|
return ((flags & feature) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
|
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Revert :c:func:`PyType_HasFeature` change: it reads again directly the
|
||||||
|
:c:member:`PyTypeObject.tp_flags` member when the limited C API is not used,
|
||||||
|
rather than always calling :c:func:`PyType_GetFlags` which hides implementation
|
||||||
|
details.
|
Loading…
Reference in New Issue