mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)
PyType_HasFeature() now always calls PyType_GetFlags() to hide implementation details. Previously, it accessed directly the PyTypeObject.tp_flags member when the limited C API was not used. Add fast inlined version _PyType_HasFeature() and _PyType_IS_GC() for object.c and typeobject.c.
This commit is contained in:
parent
ef5c615f5a
commit
45ec5b99ae
5 changed files with 46 additions and 30 deletions
|
@ -614,11 +614,7 @@ times.
|
|||
|
||||
static inline int
|
||||
PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
|
||||
#ifdef Py_LIMITED_API
|
||||
return ((PyType_GetFlags(type) & feature) != 0);
|
||||
#else
|
||||
return ((type->tp_flags & feature) != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue