-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-39573: Add Py_IS_TYPE macro #18488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,14 @@ the definition of all other Python objects. | |
(((PyObject*)(o))->ob_type) | ||
|
||
|
||
.. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type) | ||
|
||
Return true if the type of object *o* is the *type*. | ||
Equivalent to: Py_TYPE(o) == type. | ||
corona10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. versionadded:: 3.9 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ooops, I noticed a typo in one of my previous commit. Would you mind to take this PR as an opportunity to fix it? https://docs.python.org/dev/c-api/structures.html#c.Py_SET_SIZE "Set the object o size of size." => "Set ... to size." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sure :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, @brandtbucher wrote PR #18496. I will ask him to fix the typo there. You can ignore this special request ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
.. c:function:: void Py_SET_TYPE(PyObject *o, PyTypeObject *type) | ||
|
||
Set the object *o* type to *type*. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Add :c:func:`Py_IS_TYPE` static inline function to check whether | ||
corona10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the type of object *o* is the *type*. | ||
corona10 marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.