[pypy-svn] r78424 - pypy/branch/fast-forward/pypy/objspace/std
afa at codespeak.net
afa at codespeak.net
Thu Oct 28 23:33:49 CEST 2010
Author: afa
Date: Thu Oct 28 23:33:48 2010
New Revision: 78424
Modified:
pypy/branch/fast-forward/pypy/objspace/std/formatting.py
Log:
Implement the same kind of limit as cpython,
(except that cpython limit is 117)
this avoids a memory error with the '%.123456789d' format
Modified: pypy/branch/fast-forward/pypy/objspace/std/formatting.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/formatting.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/formatting.py Thu Oct 28 23:33:48 2010
@@ -41,6 +41,10 @@
def std_wp_int(self, r, prefix='', keep_zero=False):
# use self.prec to add some '0' on the left of the number
if self.prec >= 0:
+ if self.prec > 1000:
+ raise OperationError(
+ self.space.w_OverflowError, self.space.wrap(
+ 'formatted integer is too long (precision too large?)'))
sign = r[0] == '-'
padding = self.prec - (len(r)-int(sign))
if padding > 0:
More information about the Pypy-commit
mailing list