]> granicus.if.org Git - python/commitdiff
When removing indexing/slicing on exceptions some places were changed
authorBrett Cannon <bcannon@gmail.com>
Wed, 21 Mar 2007 22:26:20 +0000 (22:26 +0000)
committerBrett Cannon <bcannon@gmail.com>
Wed, 21 Mar 2007 22:26:20 +0000 (22:26 +0000)
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.

Lib/ConfigParser.py
Lib/test/test_file.py

index 9a365c08216f3399be12d9114ea7dbbbb8494695..8e644e16959a6a42fc2e973b72910cfc651c760b 100644 (file)
@@ -569,7 +569,7 @@ class ConfigParser(RawConfigParser):
                     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:
index a57ab4315838088fbaa2fb45d7a03dfbdf592245..c4bd610d3eccc709152b393a68834c8b5938c447 100644 (file)
@@ -156,7 +156,7 @@ class OtherFileTests(unittest.TestCase):
         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)