[Python-checkins] r82581 - in python/branches/release27-maint: Lib/optparse.py Misc/NEWS

r.david.murray python-checkins at python.org
Mon Jul 5 18:06:06 CEST 2010


Author: r.david.murray
Date: Mon Jul  5 18:06:05 2010
New Revision: 82581

Log:
#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.


Modified:
   python/branches/release27-maint/Lib/optparse.py
   python/branches/release27-maint/Misc/NEWS

Modified: python/branches/release27-maint/Lib/optparse.py
==============================================================================
--- python/branches/release27-maint/Lib/optparse.py	(original)
+++ python/branches/release27-maint/Lib/optparse.py	Mon Jul  5 18:06:05 2010
@@ -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]

Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Mon Jul  5 18:06:05 2010
@@ -16,6 +16,9 @@
 Library
 -------
 
+- Issue #9161: Fix regression in optparse's acceptance of unicode
+  strings in add_option calls.
+
 - Issue #9130: Fix validation of relative imports in parser module.
 
 - Issue #9128: Fix validation of class decorators in parser module.


More information about the Python-checkins mailing list