Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1ebfdd

Browse files
Call PyErr_NoMemory() when PyMem_Malloc() fails.
1 parent 8323f68 commit b1ebfdd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_tkinter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ unicodeFromTclStringAndSize(const char *s, Py_ssize_t size)
339339
const char *e = s + size;
340340
PyErr_Clear();
341341
q = buf = (char *)PyMem_Malloc(size);
342-
if (buf == NULL)
342+
if (buf == NULL) {
343+
PyErr_NoMemory();
343344
return NULL;
345+
}
344346
while (s != e) {
345347
if (s + 1 != e && s[0] == '\xc0' && s[1] == '\x80') {
346348
*q++ = '\0';

0 commit comments

Comments
 (0)