GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — bpo-39573: Use Py_IS_TYPE for type checking by petdance · Pull Request #18789 · python/cpython Conversation
|
| static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) { | ||
| return ob->ob_type == type; | ||
| } | ||
| #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST(ob), type) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have a new private _PyObject_CAST_CONST() macro rather than casting directly.
I prefer macros because maybe tomorrow we might be able to check if the pointer is valid PyObject in debug mode. Maybe using _PyObject_CheckConsistency().
Would you mind to move these changes (add the macro and modify Py_IS_TYPE to use const) into a separated PR?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll make two separate PRs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I merged PR #18809. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.