@@ -637,8 +637,16 @@ times. |
|
|
637 |
637 |
|
638 |
638 |
|
639 |
639 |
static inline int |
640 |
|
-PyType_HasFeature(PyTypeObject *type, unsigned long feature) { |
641 |
|
-return ((PyType_GetFlags(type) & feature) != 0); |
|
640 |
+PyType_HasFeature(PyTypeObject *type, unsigned long feature) |
|
641 |
+{ |
|
642 |
+unsigned long flags; |
|
643 |
+#ifdef Py_LIMITED_API |
|
644 |
+// PyTypeObject is opaque in the limited C API |
|
645 |
+flags = PyType_GetFlags(type); |
|
646 |
+#else |
|
647 |
+flags = type->tp_flags; |
|
648 |
+#endif |
|
649 |
+return ((flags & feature) != 0); |
642 |
650 |
} |
643 |
651 |
|
644 |
652 |
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag) |