[pypy-commit] pypy stdlib-2.7.6: make this a constant in rarithmetic
bdkearns
noreply at buildbot.pypy.org
Sun Mar 2 03:45:31 CET 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.6
Changeset: r69595:2ca330e1a022
Date: 2014-03-01 21:43 -0500
http://bitbucket.org/pypy/pypy/changeset/2ca330e1a022/
Log: make this a constant in rarithmetic
diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py
--- a/pypy/objspace/std/formatting.py
+++ b/pypy/objspace/std/formatting.py
@@ -7,6 +7,7 @@
from rpython.rlib.rfloat import formatd, DTSF_ALT, isnan, isinf
from rpython.rlib.rstring import StringBuilder, UnicodeBuilder
from rpython.rlib.unroll import unrolling_iterable
+from rpython.rlib.rarithmetic import INT_MAX
from rpython.tool.sourcetools import func_with_new_name
@@ -225,7 +226,7 @@
if self.peekchr() == '.':
self.forward()
- self.prec = self.peel_num('prec', 2**31 - 1)
+ self.prec = self.peel_num('prec', INT_MAX)
if self.prec < 0:
self.prec = 0 # this can happen: '%.*f' % (-5, 3)
else:
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -75,6 +75,8 @@
# to handle the win64 special case:
is_emulated_long = _long_typecode != 'l'
+INT_MAX = 2**(_get_bitsize('i') - 1) - 1
+
LONG_BIT = _get_long_bit()
LONG_MASK = (2**LONG_BIT)-1
LONG_TEST = 2**(LONG_BIT-1)
More information about the pypy-commit
mailing list