[Python-3000] C API cleanup str

"Martin v. Löwis" martin at v.loewis.de
Mon Aug 6 23:00:43 CEST 2007


>> Unfortunately, this made creating and retrieving asymmetric:
>> when you do PyUnicode_AsString, you'll get an UTF-8 string; when
>> you do PyUnicode_FromString, you did have to pass Latin-1. Making
>> AsString also return Latin-1 would, of course, restrict the number of
>> cases where it works.
> 
> True, UTF-8 seems to be the better choice. However all spots in the C
> source that call PyUnicode_FromString() only pass ASCII anyway, which
> will probably be the most common case.

Right - so from a practical point of view, it makes no difference.
However, we still need to agree, then standardize, now, so we can
give people a consistent picture.

>>> So should NULL support be dropped from PyUnicode_FromStringAndSize()?
>> That's my proposal, yes.
> 
> At least this would give a clear error message in case someone passes NULL.

Ok, so I'm gooing to change it, then.

Regards,
Martin


More information about the Python-3000 mailing list