bpo-40170: Convert PyObject_IS_GC() macro to a function#19464
bpo-40170: Convert PyObject_IS_GC() macro to a function#19464vstinner merged 14 commits intopython:masterfrom
Conversation
Fix typo of news
|
@shihai1991 Could you rebase the PR to pick the latest changes? |
Got it, done ;) |
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Right, please add a static inline function _PyObject_IS_GC() in pycore_object.h and modify gcmodule.c to use it (replace PyObject_IS_GC with _PyObject_IS_GC). PyObject_IS_GC() function body should just call _PyObject_IS_GC(). |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @pablogsal: please review the changes made to this pull request. |
Include/cpython/objimpl.h
Outdated
| if (PyType_IS_GC(Py_TYPE(obj))) { | ||
| return (Py_TYPE(obj)->tp_is_gc == NULL || Py_TYPE(obj)->tp_is_gc(obj)); | ||
| } | ||
| return 0; |
There was a problem hiding this comment.
| if (PyType_IS_GC(Py_TYPE(obj))) { | |
| return (Py_TYPE(obj)->tp_is_gc == NULL || Py_TYPE(obj)->tp_is_gc(obj)); | |
| } | |
| return 0; | |
| return (PyType_IS_GC(Py_TYPE(obj)) | |
| && (Py_TYPE(obj)->tp_is_gc == NULL | |
| || Py_TYPE(obj)->tp_is_gc(obj))); |
There was a problem hiding this comment.
this code style looks more simple?
Co-Authored-By: Victor Stinner <[email protected]>
Co-Authored-By: Victor Stinner <[email protected]>
Misc/NEWS.d/next/C API/2020-04-11-06-12-44.bpo-40170.cmM9oK.rst
Outdated
Show resolved
Hide resolved
|
Thanks @shihai1991! |
Thanks, folks. I learned much in this PR(especially in docs(what is user really need). |
https://bugs.python.org/issue40170