[pypy-svn] r13781 - pypy/dist/pypy/objspace/std
mwh at codespeak.net
mwh at codespeak.net
Fri Jun 24 13:28:50 CEST 2005
Author: mwh
Date: Fri Jun 24 13:28:49 2005
New Revision: 13781
Modified:
pypy/dist/pypy/objspace/std/strutil.py
Log:
appalling way of avoiding cpython overflow errors.
Modified: pypy/dist/pypy/objspace/std/strutil.py
==============================================================================
--- pypy/dist/pypy/objspace/std/strutil.py (original)
+++ pypy/dist/pypy/objspace/std/strutil.py Fri Jun 24 13:28:49 2005
@@ -213,8 +213,24 @@
i += 1
if exponent:
- e = string_to_int(exponent)
- r *= 10.0 ** e
+ try:
+ e = string_to_int(exponent)
+ except ParseStringOverflowError:
+ if exponent[0] == '-':
+ return 0.0
+ else:
+ if sign == '-':
+ return -1e200 * 1e200
+ else:
+ return 1e200 * 1e200
+ if e > 0:
+ while e > 0:
+ r *= 10.0
+ e -= 1
+ else:
+ while e < 0:
+ r /= 10.0
+ e += 1
if sign == '-':
r = -r
More information about the Pypy-commit
mailing list