Skip to content

Commit a705b5f

Browse files
sobolevnmiss-islington
authored andcommitted
gh-151126: Sets missing exceptions in tkinter and socket modules initializations (GH-152418)
(cherry picked from commit a9fa856) Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent 5590ea4 commit a705b5f

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix two crashes in :mod:`tkinter` and :mod:`socket` modules initialization
2+
under a memory pressure. Sets missing :exc:`MemoryError`.

Modules/_tkinter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3528,7 +3528,7 @@ PyInit__tkinter(void)
35283528

35293529
tcl_lock = PyThread_allocate_lock();
35303530
if (tcl_lock == NULL)
3531-
return NULL;
3531+
return PyErr_NoMemory();
35323532

35333533
m = PyModule_Create(&_tkintermodule);
35343534
if (m == NULL)

Modules/socketmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9234,6 +9234,7 @@ socket_exec(PyObject *m)
92349234
#if defined(USE_GETHOSTBYNAME_LOCK)
92359235
netdb_lock = PyThread_allocate_lock();
92369236
if (netdb_lock == NULL) {
9237+
PyErr_NoMemory();
92379238
goto error;
92389239
}
92399240
#endif

0 commit comments

Comments
 (0)