Clear the internal lookup cache. Return the current version tag.
+.. c:function:: long PyType_GetFlags(PyTypeObject* type)
+
+ Return the :attr:`tp_flags` member of *type*. This function is primarily
+ meant for use with `Py_LIMITED_API`; the individual flag bits are
+ guaranteed to be stable across Python releases, but access to
+ :attr:`tp_flags` itself is not part of the limited API.
+
+ .. versionadded:: 3.2
.. c:function:: void PyType_Modified(PyTypeObject *type)
PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
+PyAPI_FUNC(long) PyType_GetFlags(PyTypeObject*);
+
#define PyType_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
Py_TPFLAGS_HAVE_VERSION_TAG | \
0)
+#ifdef Py_LIMITED_API
+#define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0)
+#else
#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0)
+#endif
#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f)
Core and Builtins
-----------------
+- Issue #11067: Add PyType_GetFlags, to support PyUnicode_Check
+ in the limited ABI.
+
- Issue #11118: Fix bogus export of None in python3.dll.
Library
static PyObject *
Xxo_demo(XxoObject *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":demo"))
+ PyObject *o = NULL;
+ if (!PyArg_ParseTuple(args, "|O:demo", &o))
return NULL;
+ /* Test availability of fast type checks */
+ if (o != NULL && PyUnicode_Check(o)) {
+ Py_INCREF(o);
+ return o;
+ }
Py_INCREF(Py_None);
return Py_None;
}
return res;
}
+long
+PyType_GetFlags(PyTypeObject *type)
+{
+ return type->tp_flags;
+}
+
static PyObject *
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
PyType_FromSpec=python32.PyType_FromSpec\r
PyType_GenericAlloc=python32.PyType_GenericAlloc\r
PyType_GenericNew=python32.PyType_GenericNew\r
+ PyType_GetFlags=python32.PyType_GetFlags\r
PyType_IsSubtype=python32.PyType_IsSubtype\r
PyType_Modified=python32.PyType_Modified\r
PyType_Ready=python32.PyType_Ready\r
PyType_FromSpec\r
PyType_GenericAlloc\r
PyType_GenericNew\r
+PyType_GetFlags\r
PyType_IsSubtype\r
PyType_Modified\r
PyType_Ready\r