mirror of
https://github.com/python/cpython.git
synced 2024-11-30 21:34:17 +08:00
Call PyErr_NoMemory() when PyMem_Malloc() fails.
This commit is contained in:
parent
8323f68f3e
commit
b1ebfdddb3
@ -339,8 +339,10 @@ unicodeFromTclStringAndSize(const char *s, Py_ssize_t size)
|
||||
const char *e = s + size;
|
||||
PyErr_Clear();
|
||||
q = buf = (char *)PyMem_Malloc(size);
|
||||
if (buf == NULL)
|
||||
if (buf == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
while (s != e) {
|
||||
if (s + 1 != e && s[0] == '\xc0' && s[1] == '\x80') {
|
||||
*q++ = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user