[Python-checkins] cpython (3.4): Issue #9307: document the various Py_TPFLAGS_*_SUBCLASS flags. Patch by Yury
antoine.pitrou
python-checkins at python.org
Tue Apr 29 01:39:32 CEST 2014
http://hg.python.org/cpython/rev/37786ae8cc1c
changeset: 90492:37786ae8cc1c
branch: 3.4
parent: 90490:6ab3193e890e
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Apr 29 01:39:03 2014 +0200
summary:
Issue #9307: document the various Py_TPFLAGS_*_SUBCLASS flags. Patch by Yury V. Zaytsev.
files:
Doc/c-api/typeobj.rst | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -464,6 +464,24 @@
: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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list