Author: Armin Rigo <[email protected]>
Branch:
Changeset: r91876:68a1a6af2bf4
Date: 2017-07-15 12:58 +0200
http://bitbucket.org/pypy/pypy/changeset/68a1a6af2bf4/
Log: Ooops, backout these changes that are not ready
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -34,7 +34,6 @@
from pypy.objspace.std.tupleobject import W_AbstractTupleObject
from pypy.objspace.std.unicodeobject import W_UnicodeObject
from pypy.objspace.std.util import get_positive_index, negate
-from pypy.objspace.std.noneobject import W_NoneObject
__all__ = ['W_ListObject', 'make_range_list', 'make_empty_list_with_size']
@@ -122,8 +121,6 @@
elif type(w_obj) is W_FloatObject:
if longlong2float.can_encode_float(space.float_w(w_obj)):
continue # ok
- elif type(w_obj) is W_NoneObject:
- continue # ok
break
else:
return space.fromcache(IntOrFloatListStrategy)
@@ -1731,8 +1728,7 @@
return True
def switch_to_next_strategy(self, w_list, w_sample_item):
- if (type(w_sample_item) is W_FloatObject or
- type(w_sample_item) is W_NoneObject):
+ if type(w_sample_item) is W_FloatObject:
if self.switch_to_int_or_float_strategy(w_list):
# yes, we can switch to IntOrFloatListStrategy
# (ignore here the extremely unlikely case where
@@ -1842,16 +1838,12 @@
return True
def switch_to_next_strategy(self, w_list, w_sample_item):
- try_switch = False
if type(w_sample_item) is W_IntObject:
sample_intval = self.space.int_w(w_sample_item)
if longlong2float.can_encode_int32(sample_intval):
- try_switch = True
- elif type(w_sample_item) is W_NoneObject:
- try_switch = True
- if try_switch and self.switch_to_int_or_float_strategy(w_list):
- # yes, we can switch to IntOrFloatListStrategy
- return
+ if self.switch_to_int_or_float_strategy(w_list):
+ # yes, we can switch to IntOrFloatListStrategy
+ return
# no, fall back to ObjectListStrategy
w_list.switch_to_object_strategy()
@@ -1862,8 +1854,6 @@
_none_value = longlong2float.float2longlong(0.0)
def wrap(self, llval):
- if llval == longlong2float.nan_encoded_none:
- return self.space.w_None
if longlong2float.is_int32_from_longlong_nan(llval):
intval = longlong2float.decode_int32_from_longlong_nan(llval)
return self.space.newint(intval)
@@ -1875,8 +1865,6 @@
if type(w_int_or_float) is W_IntObject:
intval = self.space.int_w(w_int_or_float)
return longlong2float.encode_int32_into_longlong_nan(intval)
- elif type(w_int_or_float) is W_NoneObject:
- return longlong2float.nan_encoded_none
else:
floatval = self.space.float_w(w_int_or_float)
return longlong2float.float2longlong(floatval)
@@ -1892,8 +1880,6 @@
elif type(w_obj) is W_FloatObject:
floatval = self.space.float_w(w_obj)
return longlong2float.can_encode_float(floatval)
- elif type(w_obj) is W_NoneObject:
- return True
else:
return False
diff --git a/rpython/rlib/longlong2float.py b/rpython/rlib/longlong2float.py
--- a/rpython/rlib/longlong2float.py
+++ b/rpython/rlib/longlong2float.py
@@ -104,12 +104,10 @@
# ____________________________________________________________
-# For encoding integers or none inside nonstandard NaN bit patterns.
+# For encoding integers inside nonstandard NaN bit patterns.
# ff ff ff fe xx xx xx xx (signed 32-bit int)
-# ff ff ff ff ff ff ff ac (none)
nan_high_word_int32 = -2 # -2 == (int)0xfffffffe
nan_encoded_zero = r_int64(nan_high_word_int32 << 32)
-nan_encoded_none = r_int64(-84)
def encode_int32_into_longlong_nan(value):
return (nan_encoded_zero +
@@ -129,9 +127,7 @@
return value == rffi.cast(lltype.Signed, rffi.cast(rffi.INT, value))
def can_encode_float(value):
- return intmask(float2longlong(value) >> 33) != -1
-assert (nan_high_word_int32 >> 1) == -1
-assert (nan_encoded_none >> 33) == -1
+ return intmask(float2longlong(value) >> 32) != nan_high_word_int32
def maybe_decode_longlong_as_float(value):
# Decode a longlong value. If a float, just return it as a float.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit