gh-105587: Remove assertion from _PyStaticObject_CheckRefcnt (#105638)

This commit is contained in:
Eddie Elizondo 2023-06-14 00:33:32 -04:00 • committed by GitHub
parent dab5a3ebe8
commit 6199fe3b32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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.