Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 846d6db

Browse files
committed
Fix a bizarre typo in the helper class ComparableException: the
__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.)
1 parent d2ebe87 commit 846d6db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/test/test_cgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __cmp__(self, anExc):
3131
return cmp(self.err.args, anExc.args)
3232

3333
def __getattr__(self, attr):
34-
return getattr(self, self.err)
34+
return getattr(self.err, attr)
3535

3636
def do_test(buf, method):
3737
env = {}

0 commit comments

Comments
 (0)