[Python-Dev] Problems with unicode_literals (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Sat Jan 17 14:03:13 CET 2009


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 @@ """addoption(Option) addoption(optstr, ..., kwarg=val, ...) """ - if type(args[0]) is types.StringType: + if type(args[0]) in types.StringTypes: option = self.optionclass(*args, **kwargs) elif len(args) == 1 and not kwargs: option = args[0]

See also related issues:

-- Victor Stinner aka haypo http://www.haypocalc.com/blog/



More information about the Python-Dev mailing list