From: Eddie Elizondo Date: Wed, 14 Jun 2023 04:33:32 +0000 (-0400) Subject: gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638) X-Git-Tag: v3.13.0a1~1755 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6199fe3b3236748033a7ce2559aeddb5a91bbbd9;p=thirdparty%2FPython%2Fcpython.git gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638) --- diff --git a/Include/internal/pycore_global_objects_fini_generated.h b/Include/internal/pycore_global_objects_fini_generated.h index 546ba6d4c552..4b8321647664 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.