summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-04-28 23:39:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-04-28 23:39:26 (GMT)
commit63aeb71909f3058ee69f6e39478f541a045c2fbd (patch)
treebfe73225daf17112a11cf446787610f02563679f /Doc/c-api
parentb1e58440f87f921bd51396f4e9a4b18dcd2def6b (diff)
parentf9f54a2f5f25973f736046917d68106dd122c15d (diff)
downloadcpython-63aeb71909f3058ee69f6e39478f541a045c2fbd.zip
cpython-63aeb71909f3058ee69f6e39478f541a045c2fbd.tar.gz
cpython-63aeb71909f3058ee69f6e39478f541a045c2fbd.tar.bz2
Issue #9307: document the various Py_TPFLAGS_*_SUBCLASS flags. Patch by Yury V. Zaytsev.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/typeobj.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 5d52315..f21d058 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -464,6 +464,24 @@ type objects) *must* have the :attr:`ob_size` field.
:const:`Py_TPFLAGS_HAVE_VERSION_TAG`.
+ .. data:: Py_TPFLAGS_LONG_SUBCLASS
+ .. data:: Py_TPFLAGS_LIST_SUBCLASS
+ .. data:: Py_TPFLAGS_TUPLE_SUBCLASS
+ .. data:: Py_TPFLAGS_BYTES_SUBCLASS
+ .. data:: Py_TPFLAGS_UNICODE_SUBCLASS
+ .. data:: Py_TPFLAGS_DICT_SUBCLASS
+ .. data:: Py_TPFLAGS_BASE_EXC_SUBCLASS
+ .. data:: Py_TPFLAGS_TYPE_SUBCLASS
+
+ These flags are used by functions such as
+ :c:func:`PyLong_Check` to quickly determine if a type is a subclass
+ of a built-in type; such specific checks are faster than a generic
+ check, like :c:func:`PyObject_IsInstance`. Custom types that inherit
+ from built-ins should have their :c:member:`~PyTypeObject.tp_flags`
+ set appropriately, or the code that interacts with such types
+ will behave differently depending on what kind of check is used.
+
+
.. data:: Py_TPFLAGS_HAVE_FINALIZE
This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is present in the