https://github.com/python/cpython/commit/2743d7f57da9dda4a051b2a134edc704fe1e9591 commit: 2743d7f57da9dda4a051b2a134edc704fe1e9591 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: sobolevn <[email protected]> date: 2026-06-27T15:26:45Z summary:
[3.14] gh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations (GH-152418) (#152421) gh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations (GH-152418) (cherry picked from commit a9fa8560143098168e0380386acbf4846c37472b) Co-authored-by: sobolevn <[email protected]> files: A Misc/NEWS.d/next/Library/2026-06-27-17-19-09.gh-issue-151126.huUyOM.rst M Modules/_tkinter.c M Modules/socketmodule.c diff --git a/Misc/NEWS.d/next/Library/2026-06-27-17-19-09.gh-issue-151126.huUyOM.rst b/Misc/NEWS.d/next/Library/2026-06-27-17-19-09.gh-issue-151126.huUyOM.rst new file mode 100644 index 000000000000000..2e51fd45b595486 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-06-27-17-19-09.gh-issue-151126.huUyOM.rst @@ -0,0 +1,2 @@ +Fix two crashes in :mod:`tkinter` and :mod:`socket` modules initialization +under a memory pressure. Sets missing :exc:`MemoryError`. diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 2153acd2b563390..a2a6a789f48937e 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3528,7 +3528,7 @@ PyInit__tkinter(void) tcl_lock = PyThread_allocate_lock(); if (tcl_lock == NULL) - return NULL; + return PyErr_NoMemory(); m = PyModule_Create(&_tkintermodule); if (m == NULL) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e229a99dd0878ec..73f55ff05742a25 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -9234,6 +9234,7 @@ socket_exec(PyObject *m) #if defined(USE_GETHOSTBYNAME_LOCK) netdb_lock = PyThread_allocate_lock(); if (netdb_lock == NULL) { + PyErr_NoMemory(); goto error; } #endif _______________________________________________ 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]
