[pypy-commit] pypy py3k: fix issue #2346

rlamy pypy.commits at gmail.com
Thu Jul 28 15:03:10 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r85899:aa48e9ae7fe2
Date: 2016-07-28 20:02 +0100
http://bitbucket.org/pypy/pypy/changeset/aa48e9ae7fe2/

Log:	fix issue #2346

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -447,9 +447,14 @@
         from pypy.objspace.std.intobject import (
             W_AbstractIntObject, W_IntObject)
         if type(w_result) is W_IntObject:
+            if space.int_w(w_result) == -1:
+                return space.wrap(-2)
             return w_result
         elif isinstance(w_result, W_IntObject):
-            return space.wrap(space.int_w(w_result))
+            result = space.int_w(w_result)
+            if result == -1:
+                result = -2
+            return space.newint(result)
         # a non W_IntObject int, assume long-like
         assert isinstance(w_result, W_AbstractIntObject)
         return w_result.descr_hash(space)
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -1036,5 +1036,4 @@
     if x >= HASH_MODULUS:
         x -= HASH_MODULUS
 
-    x = intmask(intmask(x) * sign)
-    return -2 if x == -1 else x
+    return intmask(intmask(x) * sign)


More information about the pypy-commit mailing list