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

Skip to content

Commit ca439ee

Browse files
committed
Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure
1 parent 184252a commit ca439ee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,8 @@ unicode_adjust_maxchar(PyObject **p_unicode)
20842084
return;
20852085
}
20862086
copy = PyUnicode_New(len, max_char);
2087-
_PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
2087+
if (copy != NULL)
2088+
_PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
20882089
Py_DECREF(unicode);
20892090
*p_unicode = copy;
20902091
}

0 commit comments

Comments
 (0)