[Python-checkins] r77717 - in python/trunk: Lib/distutils/command/register.py Lib/distutils/command/upload.pyLib/distutils/dist.py Lib/distutils/tests/test_register.py Lib/distutils/tests/test_upload.py Misc/NEWS

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 24 23:28:38 CET 2010


>> Even if it's not really documented, the
>> DistributionMetada class in 2.7 is supposed to hold only utf-8
>> strings.
> 
> Well, as you say, it's not documented, so the current behaviour serves
> as a specification :-)
> 
>> Then are then serialized in a file (PKG-INFO) or in a HTTP
>> request that is pushed at PyPI.
> 
> Shouldn't the encoding step be done when serializing instead?
> It's not obvious that all transports would require utf-8.

If it's a byte string, and it's not UTF-8, how can you possibly
do the encoding step when serializing???

There must be a specification of what format the meta-data have
to be passed, and requiring UTF-8 is the approach that would be
most compatible with the status quo.

>> But those commands should not be responsible for that,
> 
> Why? Dialoguing with PyPI is their job, they know what encoding to use.

They can't do that if setup.py didn't provide correct data, though.

I didn't review the original patch in question, however, I would
hope that

a) if a byte string is passed to setup, it is assumed to be UTF-8
   throughout. Breaking when strings come in other encodings is fine.
b) unicode strings also are supported, and are converted to UTF-8
   at some point.

Regards,
Martin


More information about the Python-checkins mailing list