]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-152156: Fix a crash in `interpeters.create` under limited memory conditions...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 27 Jun 2026 11:48:16 +0000 (13:48 +0200)
committerGitHub <noreply@github.com>
Sat, 27 Jun 2026 11:48:16 +0000 (11:48 +0000)
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (GH-152163)
(cherry picked from commit 3ad66bf10dbb929bcf8efd889e56a9b9068319ca)

Co-authored-by: sobolevn <mail@sobolevn.me>
Misc/NEWS.d/next/Library/2026-06-25-10-07-54.gh-issue-152156.gscPU9.rst [new file with mode: 0644]
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 (file)
index 0000000..7b45a84
--- /dev/null
@@ -0,0 +1,2 @@
+Fix a possible crash in :func:`!_interpreters.create` under limited
+memory conditions.
index 82aaea3b97bb5c25d7391588483d564572649cb0..0f8c4296722123bd9a473985c7a7fa83093a2bf3 100644 (file)
@@ -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);