Skip to content

Commit 47c8eb7

Browse files
committed
gh-151126: Sets missing exceptions in tkinter and socket modules initializations
1 parent 0a21a24 commit 47c8eb7

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
@@ -3574,7 +3574,7 @@ PyInit__tkinter(void)
35743574

35753575
tcl_lock = PyThread_allocate_lock();
35763576
if (tcl_lock == NULL)
3577-
return NULL;
3577+
return PyErr_NoMemory();
35783578

35793579
m = PyModule_Create(&_tkintermodule);
35803580
if (m == NULL)

Modules/socketmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9296,6 +9296,7 @@ socket_exec(PyObject *m)
92969296
#if defined(USE_GETHOSTBYNAME_LOCK)
92979297
netdb_lock = PyThread_allocate_lock();
92989298
if (netdb_lock == NULL) {
9299+
PyErr_NoMemory();
92999300
goto error;
93009301
}
93019302
#endif

0 commit comments

Comments
 (0)