> You mean if it were fixed it could fail, right? Code calling it should
> be checking for errors anyway because it allocates memory.
> 
> Have you tried making this particular change and seeing what fails?

I now tried, and it turned out that bytes.__reduce__ would break
(again); I fixed it and changed it in r56755.

It turned out that PyUnicode_FromString was even documented to
accept latin-1.

While I was looking at it, I wondered why PyUnicode_FromStringAndSize
allows a NULL first argument, creating a null-initialized Unicode
object. This functionality is already available as
PyUnicode_FromUnicode, and callers who previously wrote

   obuf = PyString_FromStringAndSize(NULL, bufsize);
   if (!obuf)return NULL;
   buf = PyString_AsString(buf);

could be tricked into believing that they now can change the
string object they just created - which they cannot, as
buf will just be the UTF-8 encoded version of the real string.

Regards,
Martin
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to