[Python-Dev] Problems with unicode_literals

Barry Warsaw barry at python.org
Sun Jan 18 00:20:11 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jan 17, 2009, at 8:03 AM, Victor Stinner wrote:

> Le Saturday 17 January 2009 04:45:28 Barry Warsaw, vous avez écrit :
>> The optparse one could easily be fixed for 2.6, if we agree it should
>> be fixed.  This untested patch should do it I think:
>>
>> Index: Lib/optparse.py
>> ===================================================================
>> --- Lib/optparse.py	(revision 68465)
>> +++ Lib/optparse.py	(working copy)
>> @@ -994,7 +994,7 @@
>>          """add_option(Option)
>>             add_option(opt_str, ..., kwarg=val, ...)
>>          """
>> -        if type(args[0]) is types.StringType:
>> +        if type(args[0]) in types.StringTypes:
>>              option = self.option_class(*args, **kwargs)
>>          elif len(args) == 1 and not kwargs:
>>              option = args[0]
>
> See also related issues:
> - http://bugs.python.org/issue2931: optparse: various problems with  
> unicode
> and gettext

This one definitely covers the optparse problem I complained about.

> - http://bugs.python.org/issue4319: optparse and non-ascii help  
> strings

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSXJnq3EjvBPtnXfVAQIy0QP/ZCveuE1fjdRFxd4KPnvOD9CEAOEb/bEs
k6xpcCrOrrmhaseIMMgrfDvfFnio+3kbBoewfoD1tQpWAqNmKdqmIKcPxTNUf0cL
66Wv1212O5XrJACq+UnSO50rdkMbV/oD2RMOmsQRB4MJmNSafu9KUuyl56WzIa0S
I7zBrqpcC/U=
=uoVG
-----END PGP SIGNATURE-----


More information about the Python-Dev mailing list