From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 25 Jun 2026 07:32:24 +0000 (+0200) Subject: [3.15] gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=703c9bf976227f2d5b90e9dfe47564ab345a7383;p=thirdparty%2FPython%2Fcpython.git [3.15] gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131) (#152158) gh-151763: Fix crash in `_interpqueues.create` on `MemoryError` (GH-152131) (cherry picked from commit a6c2d4ae3bd744610e1a8b70396effdabca1593d) Co-authored-by: sobolevn --- 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 000000000000..2f5e84027ad3 --- /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 9979cd3457e1..d203ddba7d9c 100644 --- a/Modules/_interpqueuesmodule.c +++ b/Modules/_interpqueuesmodule.c @@ -1101,6 +1101,7 @@ queue_create(_queues *queues, Py_ssize_t maxsize, } int64_t qid = _queues_add(queues, queue); if (qid < 0) { + queue->alive = 0; _queue_clear(queue); GLOBAL_FREE(queue); }