[Python-3000-checkins] r54510 - in python/branches/p3yk/Lib: ConfigParser.py test/test_file.py

brett.cannon python-3000-checkins at python.org
Wed Mar 21 23:26:26 CET 2007


Author: brett.cannon
Date: Wed Mar 21 23:26:20 2007
New Revision: 54510

Modified:
   python/branches/p3yk/Lib/ConfigParser.py
   python/branches/p3yk/Lib/test/test_file.py
Log:
When removing indexing/slicing on exceptions some places were changed
inappropriately from ``e[0]`` to ``e.message`` instead of ``e.args[0]``.  The
reason it needs to be the last option is the dichotomy of 'message' and 'args':
'message' can be the empty string but args[0] can have a value if more than one
argument was passed.


Modified: python/branches/p3yk/Lib/ConfigParser.py
==============================================================================
--- python/branches/p3yk/Lib/ConfigParser.py	(original)
+++ python/branches/p3yk/Lib/ConfigParser.py	Wed Mar 21 23:26:20 2007
@@ -569,7 +569,7 @@
                     value = value % vars
                 except KeyError as e:
                     raise InterpolationMissingOptionError(
-                        option, section, rawval, e.message)
+                        option, section, rawval, e.args[0])
             else:
                 break
         if "%(" in value:

Modified: python/branches/p3yk/Lib/test/test_file.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_file.py	(original)
+++ python/branches/p3yk/Lib/test/test_file.py	Wed Mar 21 23:26:20 2007
@@ -156,7 +156,7 @@
         try:
             f = open(TESTFN, bad_mode)
         except ValueError as msg:
-            if msg.message != 0:
+            if msg.args[0] != 0:
                 s = str(msg)
                 if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
                     self.fail("bad error message for invalid mode: %s" % s)


More information about the Python-3000-checkins mailing list