[pypy-commit] pypy remove-set-smm: Add type checks in operator implementations.
Manuel Jacob
noreply at buildbot.pypy.org
Wed May 15 14:01:18 CEST 2013
Author: Manuel Jacob
Branch: remove-set-smm
Changeset: r64144:47becb14728e
Date: 2013-05-15 12:22 +0200
http://bitbucket.org/pypy/pypy/changeset/47becb14728e/
Log: Add type checks in operator implementations.
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -261,32 +261,48 @@
raise
def descr_sub(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
return self.difference(w_other)
def descr_and(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
return self.intersect(w_other)
def descr_or(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
w_copy = self.copy_real()
w_copy.update(w_other)
return w_copy
def descr_xor(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
return self.symmetric_difference(w_other)
def descr_inplace_sub(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
self.difference_update(w_other)
return self
def descr_inplace_and(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
self.intersect_update(w_other)
return self
def descr_inplace_or(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
self.update(w_other)
return self
def descr_inplace_xor(self, space, w_other):
+ if not isinstance(w_other, W_BaseSetObject):
+ return space.w_NotImplemented
self.descr_symmetric_difference_update(space, w_other)
return self
More information about the pypy-commit
mailing list