]> granicus.if.org Git - python/commitdiff
Fix a bizarre typo in the helper class ComparableException: the
authorGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 15:08:37 +0000 (15:08 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 15:08:37 +0000 (15:08 +0000)
__getattr__() method, which clearly (like the other methods) was
intended to pass the __getattr__() call on to the self.err object,
mistakenly returned getattr(self, self.err) rather than
getattr(self.err, attr).  Since self.err is not a string, this always
raises a TypeError.  Apparently that doesn't bother for the one
attribute for which __getattr__() is actually called ('__coerce__'),
but it broke the rich comparisons stuff that I'm trying to get into
shape, so I'm fixing this now.  (I could also simply remove the
__getattr__() method, but fixing it seems more in the spirit of what
the ComparableException class is trying to do.)

Lib/test/test_cgi.py

index 890d1b2423d7542880cfaff48ce87db1a1d5ae6f..71e275f23a4914bbac9fb3475ef3dbaf33e4cf26 100644 (file)
@@ -31,7 +31,7 @@ class ComparableException:
         return cmp(self.err.args, anExc.args)
 
     def __getattr__(self, attr):
-        return getattr(self, self.err)
+        return getattr(self.err, attr)
 
 def do_test(buf, method):
     env = {}