Author: David C Ellis <[email protected]>
Branch: py3.6
Changeset: r95165:dc9667baf57c
Date: 2018-09-25 13:15 +0100
http://bitbucket.org/pypy/pypy/changeset/dc9667baf57c/
Log: Clean up unnecessary logic.
space.float_w does what was needed in the case the object is a
subclass of float. elif means subclasses fall through and get
converted instead of returned.
diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -228,13 +228,7 @@
"in a future version of Python." %
(space.type(w_value).name, w_obj_type.name)),
space.w_DeprecationWarning)
- if space.is_w(w_floattype, space.w_float):
- if not space.is_w(w_obj_type, space.w_float):
- if isinstance(w_obj, W_FloatObject):
- # Convert to a non-subclass float
- value = w_obj.floatval
- w_obj = space.allocate_instance(W_FloatObject,
w_floattype)
- W_FloatObject.__init__(w_obj, value)
+ elif space.is_w(w_floattype, space.w_float):
return w_obj
value = space.float_w(w_obj)
elif space.isinstance_w(w_value, space.w_unicode):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit