gh-151126: Sets missing exceptions in `tkinter` and `socket` modules initializations (GH-152418)
(cherry picked from commit
a9fa8560143098168e0380386acbf4846c37472b)
Co-authored-by: sobolevn <mail@sobolevn.me>
--- /dev/null
+Fix two crashes in :mod:`tkinter` and :mod:`socket` modules initialization
+under a memory pressure. Sets missing :exc:`MemoryError`.
tcl_lock = PyThread_allocate_lock();
if (tcl_lock == NULL)
- return NULL;
+ return PyErr_NoMemory();
m = PyModule_Create(&_tkintermodule);
if (m == NULL)
#if defined(USE_GETHOSTBYNAME_LOCK)
netdb_lock = PyThread_allocate_lock();
if (netdb_lock == NULL) {
+ PyErr_NoMemory();
goto error;
}
#endif