Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59161:06dcbb43582a
Date: 2012-12-01 14:03 +0100
http://bitbucket.org/pypy/pypy/changeset/06dcbb43582a/
Log: s/maxint/maxsize
diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -27,7 +27,7 @@
PARAMFLAG_FIN | PARAMFLAG_FLCID
)
-WIN64 = sys.platform == 'win32' and sys.maxint == 2**63 - 1
+WIN64 = sys.platform == 'win32' and sys.maxsize == 2**63 - 1
def get_com_error(errcode, riid, pIunk):
diff --git a/lib_pypy/numpypy/core/arrayprint.py
b/lib_pypy/numpypy/core/arrayprint.py
--- a/lib_pypy/numpypy/core/arrayprint.py
+++ b/lib_pypy/numpypy/core/arrayprint.py
@@ -630,8 +630,8 @@
return precision - len(s) + len(z)
-_MAXINT = sys.maxint
-_MININT = -sys.maxint-1
+_MAXINT = sys.maxsize
+_MININT = -sys.maxsize
class IntegerFormat(object):
def __init__(self, data):
try:
diff --git a/pypy/module/_ffi/test/test_funcptr.py
b/pypy/module/_ffi/test/test_funcptr.py
--- a/pypy/module/_ffi/test/test_funcptr.py
+++ b/pypy/module/_ffi/test/test_funcptr.py
@@ -95,9 +95,7 @@
from _ffi import CDLL
libm = CDLL(self.libm_name)
pow_addr = libm.getaddressindll('pow')
- fff = sys.maxint*2-1
- if sys.platform == 'win32':
- fff = sys.maxint*2+1
+ fff = sys.maxsize*2-1
assert pow_addr == self.pow_addr & fff
def test_func_fromaddr(self):
@@ -121,7 +119,7 @@
libfoo = CDLL(self.libfoo_name)
sum_xy = libfoo.getfunc('sum_xy', [types.sint, types.sint], types.sint)
assert sum_xy(30, 12) == 42
- assert sum_xy(sys.maxint*2, 0) == -2
+ assert sum_xy(sys.maxsize*2, 0) == -2
def test_void_result(self):
"""
@@ -288,7 +286,7 @@
from _ffi import CDLL, types
libfoo = CDLL(self.libfoo_name)
is_null_ptr = libfoo.getfunc('is_null_ptr', [types.void_p],
types.ulong)
- assert not is_null_ptr(sys.maxint+1)
+ assert not is_null_ptr(sys.maxsize+1)
def test_unsigned_long_args(self):
"""
@@ -303,10 +301,10 @@
libfoo = CDLL(self.libfoo_name)
sum_xy = libfoo.getfunc('sum_xy_ul', [types.ulong, types.ulong],
types.ulong)
- assert sum_xy(sys.maxint, 12) == sys.maxint+12
- assert sum_xy(sys.maxint+1, 12) == sys.maxint+13
+ assert sum_xy(sys.maxsize, 12) == sys.maxsize+12
+ assert sum_xy(sys.maxsize+1, 12) == sys.maxsize+13
#
- res = sum_xy(sys.maxint*2+3, 0)
+ res = sum_xy(sys.maxsize*2+3, 0)
assert res == 1
def test_unsigned_short_args(self):
diff --git a/pypy/module/_ffi/test/test_struct.py
b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -144,10 +144,10 @@
assert struct.getfield('sshort') == -32768
struct.setfield('sint', 43)
assert struct.getfield('sint') == 43
- struct.setfield('slong', sys.maxint+1)
- assert struct.getfield('slong') == -sys.maxint-1
- struct.setfield('slong', sys.maxint*3)
- assert struct.getfield('slong') == sys.maxint-2
+ struct.setfield('slong', sys.maxsize+1)
+ assert struct.getfield('slong') == -sys.maxsize-1
+ struct.setfield('slong', sys.maxsize*3)
+ assert struct.getfield('slong') == sys.maxsize-2
def test_getfield_setfield_unsigned_types(self):
import sys
diff --git a/pypy/module/_multibytecodec/test/test_app_codecs.py
b/pypy/module/_multibytecodec/test/test_app_codecs.py
--- a/pypy/module/_multibytecodec/test/test_app_codecs.py
+++ b/pypy/module/_multibytecodec/test/test_app_codecs.py
@@ -59,7 +59,7 @@
import codecs
import sys
codecs.register_error("test.test_decode_custom_error_handler_overflow",
- lambda e: ('', sys.maxint + 1))
+ lambda e: ('', sys.maxsize + 1))
raises((IndexError, OverflowError), b"abc\xDD".decode, "hz",
"test.test_decode_custom_error_handler_overflow")
diff --git a/pypy/module/_socket/test/test_sock_app.py
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -420,7 +420,7 @@
else:
assert False
try:
- func(sys.maxint*2+2)
+ func(sys.maxsize*2+2)
except OverflowError:
pass
else:
diff --git a/pypy/module/cpyext/test/test_longobject.py
b/pypy/module/cpyext/test/test_longobject.py
--- a/pypy/module/cpyext/test/test_longobject.py
+++ b/pypy/module/cpyext/test/test_longobject.py
@@ -127,7 +127,7 @@
return PyLong_FromUnsignedLong((unsigned long)-1);
""")])
import sys
- assert module.from_unsignedlong() == 2 * sys.maxint + 1
+ assert module.from_unsignedlong() == 2 * sys.maxsize + 1
def test_fromlonglong(self):
module = self.import_extension('foo', [
diff --git a/pypy/module/cpyext/test/test_typeobject.py
b/pypy/module/cpyext/test/test_typeobject.py
--- a/pypy/module/cpyext/test/test_typeobject.py
+++ b/pypy/module/cpyext/test/test_typeobject.py
@@ -94,7 +94,7 @@
raises(TypeError, "obj.char_member = 42")
#
import sys
- bignum = sys.maxint - 42
+ bignum = sys.maxsize - 42
obj.short_member = -12345; assert obj.short_member == -12345
obj.long_member = -bignum; assert obj.long_member == -bignum
obj.ushort_member = 45678; assert obj.ushort_member == 45678
@@ -107,7 +107,7 @@
obj.double_member = 9.25; assert obj.double_member == 9.25
obj.longlong_member = -2**59; assert obj.longlong_member == -2**59
obj.ulonglong_member = 2**63; assert obj.ulonglong_member == 2**63
- obj.ssizet_member = sys.maxint;assert obj.ssizet_member == sys.maxint
+ obj.ssizet_member = sys.maxsize;assert obj.ssizet_member == sys.maxsize
#
def test_staticmethod(self):
diff --git a/pypy/module/fcntl/test/test_fcntl.py
b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -199,7 +199,7 @@
for plat in ('darwin', 'openbsd', 'freebsd')):
skip("Mac OS doesn't have any large flag in fcntl.h")
import fcntl, sys
- if sys.maxint == 2147483647:
+ if sys.maxsize == 2147483647:
assert fcntl.DN_MULTISHOT == -2147483648
else:
assert fcntl.DN_MULTISHOT == 2147483648
diff --git a/pypy/module/marshal/test/test_marshal.py
b/pypy/module/marshal/test/test_marshal.py
--- a/pypy/module/marshal/test/test_marshal.py
+++ b/pypy/module/marshal/test/test_marshal.py
@@ -48,9 +48,9 @@
case = -17
self.marshal_check(case)
- def test_sys_dot_maxint(self):
+ def test_sys_dot_maxsize(self):
import sys
- case = sys.maxint
+ case = sys.maxsize
self.marshal_check(case)
def test__minus_1_dot_25(self):
diff --git a/pypy/module/struct/test/test_struct.py
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -354,12 +354,12 @@
pack = self.struct.pack
unpack = self.struct.unpack
someerror = (OverflowError, self.struct.error)
- raises(someerror, calcsize, "%dc" % (sys.maxint+1,))
+ raises(someerror, calcsize, "%dc" % (sys.maxsize+1,))
raises(someerror, calcsize, "999999999999999999999999999c")
- raises(someerror, calcsize, "%di" % (sys.maxint,))
- raises(someerror, calcsize, "%dcc" % (sys.maxint,))
- raises(someerror, calcsize, "c%dc" % (sys.maxint,))
- raises(someerror, calcsize, "%dci" % (sys.maxint,))
+ raises(someerror, calcsize, "%di" % (sys.maxsize,))
+ raises(someerror, calcsize, "%dcc" % (sys.maxsize,))
+ raises(someerror, calcsize, "c%dc" % (sys.maxsize,))
+ raises(someerror, calcsize, "%dci" % (sys.maxsize,))
def test_unicode(self):
diff --git a/pypy/module/test_lib_pypy/test_itertools.py
b/pypy/module/test_lib_pypy/test_itertools.py
--- a/pypy/module/test_lib_pypy/test_itertools.py
+++ b/pypy/module/test_lib_pypy/test_itertools.py
@@ -13,10 +13,10 @@
import sys
itertools = self.itertools
- slic = itertools.islice(itertools.count(), 1, 10, sys.maxint)
+ slic = itertools.islice(itertools.count(), 1, 10, sys.maxsize)
assert len(list(slic)) == 1
if '__pypy__' not in sys.builtin_module_names:
skip("this takes ages on top of CPython's itertools module")
- slic = itertools.islice(itertools.count(), 1, 10, sys.maxint-20)
+ slic = itertools.islice(itertools.count(), 1, 10, sys.maxsize-20)
assert len(list(slic)) == 1
diff --git a/pypy/module/zlib/test/test_zlib.py
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -78,7 +78,7 @@
def test_crc32_long_start(self):
import sys
- v = self.zlib.crc32(b'', sys.maxint*2)
+ v = self.zlib.crc32(b'', sys.maxsize*2)
assert v == -2
assert self.zlib.crc32(b'foo', 99999999999999999999999) == 1635107045
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit