Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: 
Changeset: r77149:a1e2640a842c
Date: 2015-05-05 23:05 +0200
http://bitbucket.org/pypy/pypy/changeset/a1e2640a842c/

Log:    merge

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -181,14 +181,14 @@
     def set(space, w_descr, w_obj, w_val):
         w_set = space.lookup(w_descr, '__set__')
         if w_set is None:
-            raise oefmt(space.w_TypeError,
+            raise oefmt(space.w_AttributeError,
                         "'%T' object is not a descriptor with set", w_descr)
         return space.get_and_call_function(w_set, w_descr, w_obj, w_val)
 
     def delete(space, w_descr, w_obj):
         w_delete = space.lookup(w_descr, '__delete__')
         if w_delete is None:
-            raise oefmt(space.w_TypeError,
+            raise oefmt(space.w_AttributeError,
                         "'%T' object is not a descriptor with delete", w_descr)
         return space.get_and_call_function(w_delete, w_descr, w_obj)
 
diff --git a/pypy/objspace/test/test_descroperation.py 
b/pypy/objspace/test/test_descroperation.py
--- a/pypy/objspace/test/test_descroperation.py
+++ b/pypy/objspace/test/test_descroperation.py
@@ -783,3 +783,19 @@
         assert [2] + A1([3]) == [2, 3]
         assert type([2] + A1([3])) is list
         assert [2] + A2([3]) == 42
+
+    def test_data_descriptor_without_delete(self):
+        class D(object):
+            def __set__(self, x, y):
+                pass
+        class A(object):
+            d = D()
+        raises(AttributeError, "del A().d")
+
+    def test_data_descriptor_without_set(self):
+        class D(object):
+            def __delete__(self, x):
+                pass
+        class A(object):
+            d = D()
+        raises(AttributeError, "A().d = 5")
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to