Author: Manuel Jacob
Branch: remove-remaining-smm
Changeset: r69308:301f03687bca
Date: 2014-02-23 23:16 +0100
http://bitbucket.org/pypy/pypy/changeset/301f03687bca/
Log: Kill complex.__hash__ SMM.
diff --git a/pypy/objspace/std/complexobject.py
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -336,6 +336,12 @@
return space.newtuple([space.newfloat(self.realval),
space.newfloat(self.imagval)])
+ def descr_hash(self, space):
+ hashreal = _hash_float(space, self.realval)
+ hashimg = _hash_float(space, self.imagval)
+ combined = intmask(hashreal + 1000003 * hashimg)
+ return space.newint(combined)
+
def descr_add(self, space, w_rhs):
w_rhs = to_complex(space, w_rhs)
return W_ComplexObject(self.realval + w_rhs.realval,
@@ -463,12 +469,6 @@
if space.isinstance_w(w_obj, space.w_float):
return W_ComplexObject(w_obj.floatval, 0.0)
-def hash__Complex(space, w_value):
- hashreal = _hash_float(space, w_value.realval)
- hashimg = _hash_float(space, w_value.imagval)
- combined = intmask(hashreal + 1000003 * hashimg)
- return space.newint(combined)
-
def neg__Complex(space, w_complex):
return W_ComplexObject(-w_complex.realval, -w_complex.imagval)
@@ -582,6 +582,8 @@
real = complexwprop('realval'),
imag = complexwprop('imagval'),
+ __hash__ = interp2app(W_ComplexObject.descr_hash),
+
__add__ = interp2app(W_ComplexObject.descr_add),
__radd__ = interp2app(W_ComplexObject.descr_radd),
__sub__ = interp2app(W_ComplexObject.descr_sub),
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit