https://github.com/python/cpython/commit/e09bc5f0be09dab3f602702b155c9b7c98d799fc
commit: e09bc5f0be09dab3f602702b155c9b7c98d799fc
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-06-25T07:29:31Z
summary:

[3.13] gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` 
(GH-152131) (#152160)

gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131)
(cherry picked from commit a6c2d4ae3bd744610e1a8b70396effdabca1593d)

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

files:
A Misc/NEWS.d/next/Library/2026-06-25-01-00-43.gh-issue-151763.wWeHBe.rst
M 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
index 00000000000000..2f5e84027ad31b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-25-01-00-43.gh-issue-151763.wWeHBe.rst
@@ -0,0 +1,2 @@
+Fix crash in :func:`!_interpqueues.create` whe :exc:`MemoryError`
+happens on queue creation.
diff --git a/Modules/_interpqueuesmodule.c b/Modules/_interpqueuesmodule.c
index 7a89e2f13a1c72..1bab83519546c5 100644
--- a/Modules/_interpqueuesmodule.c
+++ b/Modules/_interpqueuesmodule.c
@@ -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);
     }

_______________________________________________
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