From 3caf7b9c888cafa286039379f642cbd09c7ae7cf Mon Sep 17 00:00:00 2001 From: "R. David Murray" Date: Mon, 5 Jul 2010 16:06:05 +0000 Subject: #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. --- Lib/optparse.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/optparse.py b/Lib/optparse.py index 8ab3291..87d7737 100644 --- a/Lib/optparse.py +++ b/Lib/optparse.py @@ -1008,7 +1008,7 @@ class OptionContainer: """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] diff --git a/Misc/NEWS b/Misc/NEWS index 5419617..c6e7962 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,6 +16,9 @@ Core and Builtins 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. -- cgit v0.12