diff Lib/optparse.py @ 62809:705869d1bdf0 2.7

#9161: Fix regression in acceptance of unicode strings in add_option calls. The original change in 2.6 was made during rc1 changeover, and did not get ported to 2.7. The original change may not even have been intentional, but if so it doesn't seem to have caused any problems.
author R. David Murray <rdmurray@bitdance.com>
date Mon, 05 Jul 2010 16:06:05 +0000
parents 480f7ec3b869
children b36cb4602e21
line wrap: on
line diff
--- a/Lib/optparse.py	Mon Jul 05 12:04:07 2010 +0000
+++ b/Lib/optparse.py	Mon Jul 05 16:06:05 2010 +0000
@@ -1008,7 +1008,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]