diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-09 07:40:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 07:40:40 (GMT) |
commit | 0124b5dd28eff7bb80eb7244e97e402a036db13b (patch) | |
tree | cd97f7b83b57e2115489d81a9813b7b1b3d9a726 /Tools | |
parent | f7a82cde59b82cb15cbd983ed48c46b5e074631d (diff) | |
download | cpython-0124b5dd28eff7bb80eb7244e97e402a036db13b.zip cpython-0124b5dd28eff7bb80eb7244e97e402a036db13b.tar.gz cpython-0124b5dd28eff7bb80eb7244e97e402a036db13b.tar.bz2 |
gh-90868: Add _PyStaticObject_CheckRefcnt() function (#99261)
Add _PyStaticObject_CheckRefcnt() function to make
_PyStaticObjects_CheckRefcnt() shorter. Use
_PyObject_ASSERT_FAILED_MSG() to log the object causing the fatal
error.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/build/generate_global_objects.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Tools/build/generate_global_objects.py b/Tools/build/generate_global_objects.py index 5516dcf..c7a0718 100644 --- a/Tools/build/generate_global_objects.py +++ b/Tools/build/generate_global_objects.py @@ -388,11 +388,8 @@ def generate_global_object_finalizers(immortal_objects): printer.write("static inline void") with printer.block("_PyStaticObjects_CheckRefcnt(void)"): for i in immortal_objects: - with printer.block(f'if (Py_REFCNT({i}) < _PyObject_IMMORTAL_REFCNT)', ';'): - printer.write(f'_PyObject_Dump({i});') - printer.write(f'Py_FatalError("immortal object has less refcnt than ' - 'expected _PyObject_IMMORTAL_REFCNT");') - printer.write('#endif') + printer.write(f'_PyStaticObject_CheckRefcnt({i});') + printer.write('#endif // Py_DEBUG') printer.write(END) printer.write(after) |