diff Lib/optparse.py @ 38463:51255cc8a0dc 2.4

Remove various dependencies on dictionary order in the standard library tests, and one (clearly an oversight, potentially critical) in the standard library itself - base64.py. test_extcall is an output test which still needs to be fixed somehow. Forwardporting candidate...
author Armin Rigo <arigo@tunes.org>
date Sun, 28 May 2006 18:15:43 +0000
parents 79bcad14e96a
children
line wrap: on
line diff
--- a/Lib/optparse.py	Sat May 27 16:35:31 2006 +0000
+++ b/Lib/optparse.py	Sun May 28 18:15:43 2006 +0000
@@ -547,8 +547,10 @@
                 else:
                     setattr(self, attr, None)
         if attrs:
+            attrs = attrs.keys()
+            attrs.sort()
             raise OptionError(
-                "invalid keyword arguments: %s" % ", ".join(attrs.keys()),
+                "invalid keyword arguments: %s" % ", ".join(attrs),
                 self)
 
 
@@ -1556,6 +1558,7 @@
             raise BadOptionError(_("no such option: %s") % s)
         else:
             # More than one possible completion: ambiguous prefix.
+            possibilities.sort()
             raise BadOptionError(_("ambiguous option: %s (%s?)")
                                  % (s, ", ".join(possibilities)))