Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
27f7ab72
Commit
27f7ab72
authored
Jan 20, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1219903: fix tp_richcompare docs.
parent
23bf837a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
Doc/c-api/typeobj.rst
Doc/c-api/typeobj.rst
+13
-7
No files found.
Doc/c-api/typeobj.rst
View file @
27f7ab72
...
...
@@ -662,13 +662,19 @@ The following three fields only exist if the
.. cmember:: richcmpfunc PyTypeObject.tp_richcompare
An optional pointer to the rich comparison function.
An optional pointer to the rich comparison function, whose signature is
``PyObject *tp_richcompare(PyObject *a, PyObject *b, int op)``.
The signature is the same as for :cfunc:`PyObject_RichCompare`. The function
should return the result of the comparison (usually ``Py_True`` or
``Py_False``). If the comparison is undefined, it must return
``Py_NotImplemented``, if another error occurred it must return ``NULL`` and set
an exception condition.
The function should return the result of the comparison (usually ``Py_True``
or ``Py_False``). If the comparison is undefined, it must return
``Py_NotImplemented``, if another error occurred it must return ``NULL`` and
set an exception condition.
.. note::
If you want to implement a type for which only a limited set of
comparisons makes sense (e.g. ``==`` and ``!=``, but not ``<`` and
friends), directly raise :exc:`TypeError` in the rich comparison function.
This field is inherited by subtypes together with :attr:`tp_compare` and
:attr:`tp_hash`: a subtype inherits all three of :attr:`tp_compare`,
...
...
@@ -694,10 +700,10 @@ The following three fields only exist if the
| :const:`Py_GE` | ``>=`` |
+----------------+------------+
The next field only exists if the :const:`Py_TPFLAGS_HAVE_WEAKREFS` flag bit is
set.
.. cmember:: long PyTypeObject.tp_weaklistoffset
If the instances of this type are weakly referenceable, this field is greater
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment