]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 25 Jun 2026 07:29:31 +0000 (09:29 +0200)
committerGitHub <noreply@github.com>
Thu, 25 Jun 2026 07:29:31 +0000 (07:29 +0000)
gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131)
(cherry picked from commit a6c2d4ae3bd744610e1a8b70396effdabca1593d)

Co-authored-by: sobolevn <mail@sobolevn.me>
Misc/NEWS.d/next/Library/2026-06-25-01-00-43.gh-issue-151763.wWeHBe.rst [new file with mode: 0644]
Modules/_interpqueuesmodule.c

diff --git a/Misc/NEWS.d/next/Library/2026-06-25-01-00-43.gh-issue-151763.wWeHBe.rst b/Misc/NEWS.d/next/Library/2026-06-25-01-00-43.gh-issue-151763.wWeHBe.rst
new file mode 100644 (file)
index 0000000..2f5e840
--- /dev/null
@@ -0,0 +1,2 @@
+Fix crash in :func:`!_interpqueues.create` whe :exc:`MemoryError`
+happens on queue creation.
index 7a89e2f13a1c72a271245972150111dda61d4194..1bab83519546c52f1788afc67cbe6a4aabd400fb 100644 (file)
@@ -1108,6 +1108,7 @@ queue_create(_queues *queues, Py_ssize_t maxsize, int fmt, int unboundop)
     }
     int64_t qid = _queues_add(queues, queue);
     if (qid < 0) {
+        queue->alive = 0;
         _queue_clear(queue);
         GLOBAL_FREE(queue);
     }