[Python-checkins] [3.12] gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (GH-105638) (#105769)
kumaraditya303
webhook-mailer at python.org
Wed Jun 14 01:04:29 EDT 2023
https://github.com/python/cpython/commit/0a9346d3d8b52e585a43ee6c7708e5a639fa9fed
commit: 0a9346d3d8b52e585a43ee6c7708e5a639fa9fed
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-06-14T05:04:22Z
summary:
[3.12] gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (GH-105638) (#105769)
gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (GH-105638)
(cherry picked from commit 6199fe3b3236748033a7ce2559aeddb5a91bbbd9)
Co-authored-by: Eddie Elizondo <eduardo.elizondorueda at gmail.com>
files:
A Misc/NEWS.d/next/Core and Builtins/2023-06-10-21-38-49.gh-issue-105587.rL3rzv.rst
M Include/internal/pycore_global_objects_fini_generated.h
diff --git a/Include/internal/pycore_global_objects_fini_generated.h b/Include/internal/pycore_global_objects_fini_generated.h
index d5819fcd1c50..439f47a263df 100644
--- a/Include/internal/pycore_global_objects_fini_generated.h
+++ b/Include/internal/pycore_global_objects_fini_generated.h
@@ -12,9 +12,8 @@ extern "C" {
static inline void
_PyStaticObject_CheckRefcnt(PyObject *obj) {
if (Py_REFCNT(obj) < _Py_IMMORTAL_REFCNT) {
- _PyObject_ASSERT_FAILED_MSG(obj,
- "immortal object has less refcnt than expected "
- "_Py_IMMORTAL_REFCNT");
+ fprintf(stderr, "Immortal Object has less refcnt than expected.\n");
+ _PyObject_Dump(obj);
}
}
#endif
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-06-10-21-38-49.gh-issue-105587.rL3rzv.rst b/Misc/NEWS.d/next/Core and Builtins/2023-06-10-21-38-49.gh-issue-105587.rL3rzv.rst
new file mode 100644
index 000000000000..488f82c3fb57
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-06-10-21-38-49.gh-issue-105587.rL3rzv.rst
@@ -0,0 +1,3 @@
+The runtime can't guarantee that immortal objects will not be mutated by
+Extensions. Thus, this modifies _PyStaticObject_CheckRefcnt to warn
+instead of asserting.
More information about the Python-checkins
mailing list