https://github.com/python/cpython/commit/bbcd28e00b3a55dcb5d135ad39e73c29a0b04f2e
commit: bbcd28e00b3a55dcb5d135ad39e73c29a0b04f2e
branch: 3.14
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-06-11T13:34:41Z
summary:
[3.14] gh-151126: Fix missing memory errors in `_interpchannelsmodule.c`
(GH-151239) (#151336)
(cherry picked from commit 9fd1a125bc0ebdc26eae684da6e48ef24ee23b34)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-10-28-30.gh-issue-151126.DKa6Sl.rst
A Misc/NEWS.d/next/Library/2026-06-11-16-07-00.gh-issue-151126.cWw5pb.rst
M Modules/_interpchannelsmodule.c
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-10-28-30.gh-issue-151126.DKa6Sl.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-10-28-30.gh-issue-151126.DKa6Sl.rst
new file mode 100644
index 000000000000000..c91939dbe559cd5
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-06-09-10-28-30.gh-issue-151126.DKa6Sl.rst
@@ -0,0 +1,4 @@
+Fix a crash, when there's no memory left on a device,
+which happened in :mod:`!_interpchannels` module.
+
+Now it raises proper :exc:`MemoryError` errors.
diff --git
a/Misc/NEWS.d/next/Library/2026-06-11-16-07-00.gh-issue-151126.cWw5pb.rst
b/Misc/NEWS.d/next/Library/2026-06-11-16-07-00.gh-issue-151126.cWw5pb.rst
new file mode 100644
index 000000000000000..f27744d42f48246
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-11-16-07-00.gh-issue-151126.cWw5pb.rst
@@ -0,0 +1,4 @@
+Fix a crash, when there's no memory left on a device, which happened in
+:mod:`!_interpchannels` module.
+
+Now it raises proper :exc:`MemoryError` errors.
diff --git a/Modules/_interpchannelsmodule.c b/Modules/_interpchannelsmodule.c
index be3a932ca03d395..183279fdce7d049 100644
--- a/Modules/_interpchannelsmodule.c
+++ b/Modules/_interpchannelsmodule.c
@@ -921,7 +921,8 @@ static _channelends *
_channelends_new(void)
{
_channelends *ends = GLOBAL_MALLOC(_channelends);
- if (ends== NULL) {
+ if (ends == NULL) {
+ PyErr_NoMemory();
return NULL;
}
ends->numsendopen = 0;
@@ -1115,6 +1116,7 @@ _channel_new(PyThread_type_lock mutex, struct
_channeldefaults defaults)
assert(check_unbound(defaults.unboundop));
_channel_state *chan = GLOBAL_MALLOC(_channel_state);
if (chan == NULL) {
+ PyErr_NoMemory();
return NULL;
}
chan->mutex = mutex;
@@ -1313,6 +1315,7 @@ _channelref_new(int64_t cid, _channel_state *chan)
{
_channelref *ref = GLOBAL_MALLOC(_channelref);
if (ref == NULL) {
+ PyErr_NoMemory();
return NULL;
}
ref->cid = cid;
@@ -1698,6 +1701,7 @@ _channel_set_closing(_channelref *ref, PyThread_type_lock
mutex) {
}
chan->closing = GLOBAL_MALLOC(struct _channel_closing);
if (chan->closing == NULL) {
+ PyErr_NoMemory();
goto done;
}
chan->closing->ref = ref;
_______________________________________________
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]