[pypy-svn] r79851 - in pypy/trunk/pypy/objspace/std: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Dec 6 17:20:25 CET 2010
Author: cfbolz
Date: Mon Dec 6 17:20:24 2010
New Revision: 79851
Modified:
pypy/trunk/pypy/objspace/std/complextype.py
pypy/trunk/pypy/objspace/std/floattype.py
pypy/trunk/pypy/objspace/std/strutil.py
pypy/trunk/pypy/objspace/std/test/test_strutil.py
Log:
remove unused space argument
Modified: pypy/trunk/pypy/objspace/std/complextype.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/complextype.py (original)
+++ pypy/trunk/pypy/objspace/std/complextype.py Mon Dec 6 17:20:24 2010
@@ -1,7 +1,7 @@
from pypy.interpreter import gateway
from pypy.interpreter.error import OperationError
from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.strutil import interp_string_to_float, ParseStringError
+from pypy.objspace.std.strutil import string_to_float, ParseStringError
from pypy.objspace.std.noneobject import W_NoneObject
from pypy.objspace.std.stdtypedef import GetSetProperty, StdTypeDef
from pypy.objspace.std.stdtypedef import StdObjSpaceMultiMethod
@@ -131,8 +131,8 @@
except ValueError:
raise OperationError(space.w_ValueError, space.wrap(ERR_MALFORMED))
try:
- realval = interp_string_to_float(space, realstr)
- imagval = interp_string_to_float(space, imagstr)
+ realval = string_to_float(realstr)
+ imagval = string_to_float(imagstr)
except ParseStringError:
raise OperationError(space.w_ValueError, space.wrap(ERR_MALFORMED))
else:
Modified: pypy/trunk/pypy/objspace/std/floattype.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/floattype.py (original)
+++ pypy/trunk/pypy/objspace/std/floattype.py Mon Dec 6 17:20:24 2010
@@ -2,7 +2,7 @@
from pypy.interpreter.error import OperationError
from pypy.objspace.std.stdtypedef import StdTypeDef
from pypy.objspace.std.strutil import ParseStringError
-from pypy.objspace.std.strutil import interp_string_to_float
+from pypy.objspace.std.strutil import string_to_float
def descr__new__(space, w_floattype, w_x=0.0):
from pypy.objspace.std.floatobject import W_FloatObject
@@ -10,7 +10,7 @@
if space.is_true(space.isinstance(w_value, space.w_str)):
strvalue = space.str_w(w_value)
try:
- value = interp_string_to_float(space, strvalue)
+ value = string_to_float(strvalue)
except ParseStringError, e:
raise OperationError(space.w_ValueError,
space.wrap(e.msg))
@@ -21,7 +21,7 @@
from unicodeobject import unicode_to_decimal_w
strvalue = unicode_to_decimal_w(space, w_value)
try:
- value = interp_string_to_float(space, strvalue)
+ value = string_to_float(strvalue)
except ParseStringError, e:
raise OperationError(space.w_ValueError,
space.wrap(e.msg))
Modified: pypy/trunk/pypy/objspace/std/strutil.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/strutil.py (original)
+++ pypy/trunk/pypy/objspace/std/strutil.py Mon Dec 6 17:20:24 2010
@@ -150,7 +150,7 @@
del calc_mantissa_bits
MANTISSA_DIGITS = len(str( (1L << MANTISSA_BITS)-1 )) + 1
-def interp_string_to_float(space, s):
+def string_to_float(s):
"""
Conversion of string to float.
This version tries to only raise on invalid literals.
Modified: pypy/trunk/pypy/objspace/std/test/test_strutil.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_strutil.py (original)
+++ pypy/trunk/pypy/objspace/std/test/test_strutil.py Mon Dec 6 17:20:24 2010
@@ -131,8 +131,6 @@
assert string_to_bigint('1891234174197319').tolong() == 1891234174197319
def test_string_to_float(self):
- def string_to_float(x):
- return interp_string_to_float(self.space, x)
assert string_to_float('0') == 0.0
assert string_to_float('1') == 1.0
assert string_to_float('-1.5') == -1.5
More information about the Pypy-commit
mailing list