Skip to content

Commit cc35159

Browse files
committed
Issue #18408: normalizestring() now raises MemoryError on memory allocation failure
1 parent 9035ad9 commit cc35159

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/codecs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PyObject *normalizestring(const char *string)
6565

6666
p = PyMem_Malloc(len + 1);
6767
if (p == NULL)
68-
return NULL;
68+
return PyErr_NoMemory();
6969
for (i = 0; i < len; i++) {
7070
register char ch = string[i];
7171
if (ch == ' ')

0 commit comments

Comments
 (0)