gh-90868: Add _PyStaticObject_CheckRefcnt() function#99261
gh-90868: Add _PyStaticObject_CheckRefcnt() function#99261vstinner merged 1 commit intopython:mainfrom vstinner:staticobj_check_refcnt
Conversation
|
@ericsnowcurrently @kumaraditya303: This PR makes _PyStaticObjects_CheckRefcnt() more readable and shorter, what do you think? |
ericsnowcurrently
left a comment
There was a problem hiding this comment.
I have one suggestion. Otherwise this looks good.
| static inline void | ||
| _PyStaticObject_CheckRefcnt(PyObject *obj) { | ||
| if (Py_REFCNT(obj) < _PyObject_IMMORTAL_REFCNT) { | ||
| _PyObject_ASSERT_FAILED_MSG(obj, | ||
| "immortal object has less refcnt than expected " | ||
| "_PyObject_IMMORTAL_REFCNT"); | ||
| } | ||
| } |
There was a problem hiding this comment.
Rather that being part of the generated code, you could put this directly in pycore_global_objects_fini_generated.h, before the /* The following is auto-generated by Tools/build/generate_global_objects.py. */ marker line.
There was a problem hiding this comment.
Aha, I didn't notice that only some parts of this file are generated. Ok, I added my new function at the top.
|
When you're done making the requested changes, leave the comment: |
Add _PyStaticObject_CheckRefcnt() function to make _PyStaticObjects_CheckRefcnt() shorter. Use _PyObject_ASSERT_FAILED_MSG() to log the object causing the fatal error.
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @ericsnowcurrently: please review the changes made to this pull request. |
|
Merged, thanks for the review. |
Add _PyStaticObject_CheckRefcnt() function to make _PyStaticObjects_CheckRefcnt() shorter. Use
_PyObject_ASSERT_FAILED_MSG() to log the object causing the fatal error.