mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Revert "bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)" (GH-21390)
This partially reverts commit45ec5b99ae
. (cherry picked from commitb26a0db8ea
) Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
1d1c574340
commit
a0a6f11678
2 changed files with 14 additions and 2 deletions
|
@ -618,8 +618,16 @@ times.
|
|||
|
||||
|
||||
static inline int
|
||||
PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
|
||||
return ((PyType_GetFlags(type) & feature) != 0);
|
||||
PyType_HasFeature(PyTypeObject *type, unsigned long feature)
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue