Commits

Brian Kearns committed f3332cf

hack partial so test_functools passes

  • Participants
  • Parent commits 62c9c61
  • Branches stdlib-2.7.8

Comments (0)

Files changed (2)

File lib_pypy/_functools.py

         self._args = args
         self._keywords = keywords or None
 
+    def __delattr__(self, key):
+        if key == '__dict__':
+            raise TypeError("a partial object's dictionary may not be deleted")
+        object.__delattr__(self, key)
+
     @property
     def func(self):
         return self._func

File pypy/module/test_lib_pypy/test_functools.py

     partial = _functools.partial(object)
     with pytest.raises((TypeError, AttributeError)):
         partial.func = sum
+    with pytest.raises(TypeError) as exc:
+        del partial.__dict__
+    assert str(exc.value) == "a partial object's dictionary may not be deleted"
+    with pytest.raises(AttributeError):
+        del partial.zzz