[Python-checkins] bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214)

Victor Stinner webhook-mailer at python.org
Mon Jan 27 16:37:49 EST 2020

commit: 47ee8a6063c22ec272fe7a2d95d12f7811ebb48b
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-27T22:37:44+01:00

bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214)

If the export count is negative, _memory_release() now raises a
SystemError and returns -1, rather than calling Py_FatalError()
which aborts the process.

M Objects/memoryobject.c

diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 66920eaf947ab..d9dd11733ef1a 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -1048,7 +1048,8 @@ _memory_release(PyMemoryViewObject *self)
         return -1;
-    Py_FatalError("_memory_release(): negative export count");
+    PyErr_SetString(PyExc_SystemError,
+                    "_memory_release(): negative export count");
     return -1;

More information about the Python-checkins mailing list