https://github.com/python/cpython/commit/d1faedab4ea927d436c2a015d7c1c5fe50bf5a86
commit: d1faedab4ea927d436c2a015d7c1c5fe50bf5a86
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-06-27T11:48:16Z
summary:

[3.13] gh-152156: Fix a crash in `interpeters.create` under limited memory 
conditions (GH-152163) (#152270)

gh-152156: Fix a crash in `interpeters.create` under limited memory conditions 
(GH-152163)
(cherry picked from commit 3ad66bf10dbb929bcf8efd889e56a9b9068319ca)

Co-authored-by: sobolevn <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-06-25-10-07-54.gh-issue-152156.gscPU9.rst
M Modules/_interpchannelsmodule.c

diff --git 
a/Misc/NEWS.d/next/Library/2026-06-25-10-07-54.gh-issue-152156.gscPU9.rst 
b/Misc/NEWS.d/next/Library/2026-06-25-10-07-54.gh-issue-152156.gscPU9.rst
new file mode 100644
index 000000000000000..7b45a843b8f43b8
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-25-10-07-54.gh-issue-152156.gscPU9.rst
@@ -0,0 +1,2 @@
+Fix a possible crash in :func:`!_interpreters.create` under limited
+memory conditions.
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index 82aaea3b97bb5c2..0f8c4296722123b 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -2919,10 +2919,8 @@ channelsmod_create(PyObject *self, PyObject *args, 
PyObject *kwds)
                            (channelid **)&cidobj);
     if (handle_channel_error(err, self, cid)) {
         assert(cidobj == NULL);
-        err = channel_destroy(&_globals.channels, cid);
-        if (handle_channel_error(err, self, cid)) {
-            // XXX issue a warning?
-        }
+        assert(PyErr_Occurred());
+        (void)channel_destroy(&_globals.channels, cid);
         return NULL;
     }
     assert(cidobj != NULL);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to