[pypy-commit] pypy ep2016sprint: removed long codepath (covered by the last elif path), removed duplicate comments

p_zi...@yahoo.de pypy.commits at gmail.com
Sat Jul 23 12:05:50 EDT 2016


Author: p_zieschang at yahoo.de
Branch: ep2016sprint
Changeset: r85831:d9a653291715
Date: 2016-07-23 17:33 +0200
http://bitbucket.org/pypy/pypy/changeset/d9a653291715/

Log:	removed long codepath (covered by the last elif path), removed
	duplicate comments

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -425,29 +425,21 @@
                         "'%T' objects are unhashable", w_obj)
         w_result = space.get_and_call_function(w_hash, w_obj)
         w_resulttype = space.type(w_result)
-        
+
+        # issue 2346 : returns now -2 for hashing -1 like cpython
         if space.is_w(w_resulttype, space.w_int):
-            # bug 2346 (return -2 for a hashvalue of -1)
             if space.int_w(w_result) == -1:
                 return space.wrap(-2)
             return w_result
-        elif space.is_w(w_resulttype, space.w_long):
-            # bug 2346 (return -2 for a hashvalue of -1)
-            w_h = space.hash(w_result)
-            if space.int_w(w_h) == -1:
-                return space.wrap(-2)
-            return w_h
         elif space.isinstance_w(w_result, space.w_int):
             # be careful about subclasses of 'int'...
             int_result = space.int_w(w_result)
-            # bug 2346 (return -2 for a hashvalue of -1)
             if int_result == -1:
                 int_result == -2
             return space.wrap(int_result)
         elif space.isinstance_w(w_result, space.w_long):
             # be careful about subclasses of 'long'...
             bigint = space.bigint_w(w_result)
-            # bug 2346 (return -2 for a hashvalue of -1)
             h = bigint.hash()
             if h == -1:
                 h = -2


More information about the pypy-commit mailing list