summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-22 02:00:09 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-22 02:00:09 (GMT)
commit56ff387a7e625a692851e2e5ffdea096b72831f7 (patch)
tree6b5d86b12a0d5005ff31fb7ced375262bbbbe597 /Lib/test
parent51c18166bb55ff8ed72f447997bcb38574531112 (diff)
downloadcpython-56ff387a7e625a692851e2e5ffdea096b72831f7.zip
cpython-56ff387a7e625a692851e2e5ffdea096b72831f7.tar.gz
cpython-56ff387a7e625a692851e2e5ffdea096b72831f7.tar.bz2
Fix for SF bug #472940: can't getattr() attribute shown by dir()
There really isn't a good reason for instance method objects to have their own __dict__, __doc__ and __name__ properties that just delegate the request to the function (callable); the default attribute behavior already does this. The test suite had to be fixed because the error changes from TypeError to AttributeError.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_funcattrs.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 2411f6a..293b911 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -108,8 +108,8 @@ if f1.a.myclass is not f2.a.myclass or \
# try setting __dict__
try:
F.a.__dict__ = (1, 2, 3)
-except TypeError: pass
-else: raise TestFailed, 'expected TypeError'
+except (AttributeError, TypeError): pass
+else: raise TestFailed, 'expected TypeError or AttributeError'
F.a.im_func.__dict__ = {'one': 11, 'two': 22, 'three': 33}
@@ -121,7 +121,7 @@ d = UserDict({'four': 44, 'five': 55})
try:
F.a.__dict__ = d
-except TypeError: pass
+except (AttributeError, TypeError): pass
else: raise TestFailed
if f2.a.one <> f1.a.one <> F.a.one <> 11:
@@ -218,13 +218,13 @@ def cantset(obj, name, value):
verify(hasattr(obj, name)) # Otherwise it's probably a typo
try:
setattr(obj, name, value)
- except TypeError:
+ except (AttributeError, TypeError):
pass
else:
raise TestFailed, "shouldn't be able to set %s to %r" % (name, value)
try:
delattr(obj, name)
- except TypeError:
+ except (AttributeError, TypeError):
pass
else:
raise TestFailed, "shouldn't be able to del %s" % name