@@ -618,8 +618,16 @@ times. |
|
|
618 |
618 |
|
619 |
619 |
|
620 |
620 |
static inline int |
621 |
|
-PyType_HasFeature(PyTypeObject *type, unsigned long feature) { |
622 |
|
-return ((PyType_GetFlags(type) & feature) != 0); |
|
621 |
+PyType_HasFeature(PyTypeObject *type, unsigned long feature) |
|
622 |
+{ |
|
623 |
+unsigned long flags; |
|
624 |
+#ifdef Py_LIMITED_API |
|
625 |
+// PyTypeObject is opaque in the limited C API |
|
626 |
+flags = PyType_GetFlags(type); |
|
627 |
+#else |
|
628 |
+flags = type->tp_flags; |
|
629 |
+#endif |
|
630 |
+return ((flags & feature) != 0); |
623 |
631 |
} |
624 |
632 |
|
625 |
633 |
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag) |