[Python-Dev] cpython: Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Oct 29 10:54:08 CET 2013


2013/10/29 Georg Brandl <g.brandl at gmx.net>:

diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3766,6 +3766,7 @@ return NULL; PyUnicodeUTF8(unicode) = PyObjectMALLOC(PyBytesGETSIZE(bytes) + 1); if (PyUnicodeUTF8(unicode) == NULL) { + PyErrNoMemory(); PyDECREF(bytes); return NULL; } Shouldn't this (and related commits from #18408) have been committed to the 3.3 branch?

All changes of #18408 "should" be backported, but I don't plan to backport them. It is not trivial to backport them. Nobody complained before (memory allocation failure are usually bad handled anyway, it will crash later if it does not crash here). And I'm not 100% confident that these changes would not break anything.

Examples of possible regression:

If there is really a regression, I prefer to limit it to the new version, not to a stable version.

Note: I'm not saying that I'm 0% confident in my changes :-)

Victor



More information about the Python-Dev mailing list