[pypy-svn] pypy fast-forward: in CPython, setting a read-only property() raises AttributeError;

amauryfa commits-noreply at bitbucket.org
Fri Jan 14 08:41:50 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40657:e5642e67837d
Date: 2011-01-14 08:41 +0100
http://bitbucket.org/pypy/pypy/changeset/e5642e67837d/

Log:	in CPython, setting a read-only property() raises AttributeError;
	setting a read-only C type member raises TypeError. PyPy at least is
	consistent...

diff --git a/lib-python/modified-2.7.0/test/test_funcattrs.py b/lib-python/modified-2.7.0/test/test_funcattrs.py
--- a/lib-python/modified-2.7.0/test/test_funcattrs.py
+++ b/lib-python/modified-2.7.0/test/test_funcattrs.py
@@ -14,6 +14,8 @@
         self.b = b
 
     def cannot_set_attr(self, obj, name, value, exceptions):
+        if not test_support.check_impl_detail():
+            exceptions = (TypeError, AttributeError)
         # Helper method for other tests.
         try:
             setattr(obj, name, value)
@@ -286,13 +288,13 @@
     def test_delete_func_dict(self):
         try:
             del self.b.__dict__
-        except TypeError:
+        except (AttributeError, TypeError):
             pass
         else:
             self.fail("deleting function dictionary should raise TypeError")
         try:
             del self.b.func_dict
-        except TypeError:
+        except (AttributeError, TypeError):
             pass
         else:
             self.fail("deleting function dictionary should raise TypeError")


More information about the Pypy-commit mailing list