Repository: numpy/numpy

Issue:
2to3 run `renames` fixer
```
sys.maxint <- sys.maxsize
sys.minint <- sys.minsize 
```

These aren't the same things. In python 2 it is the size of the python 'small' integer, in python 3 there is no 'small' integer and it refers to Py_ssize_t.

This only affects oldnumeric, we should probably leave as is and raise an error if run in python 3.



Discussion:

Resolving patch:
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -22,6 +22,12 @@
 from .multiarray import format_longfloat, datetime_as_string, datetime_data
 from .fromnumeric import ravel
 
+if sys.version_info[0] >= 3:
+    _MAXINT = sys.maxsize
+    _MININT = -sys.maxsize - 1
+else:
+    _MAXINT = sys.maxint
+    _MININT = -sys.maxint - 1
 
 def product(x, y): return x*y
 
@@ -633,8 +639,6 @@ def _digits(x, precision, format):
     return precision - len(s) + len(z)
 
 
-_MAXINT = sys.maxint
-_MININT = -sys.maxint-1
 class IntegerFormat(object):
     def __init__(self, data):
         try:
diff --git a/numpy/oldnumeric/ma.py b/numpy/oldnumeric/ma.py
--- a/numpy/oldnumeric/ma.py
+++ b/numpy/oldnumeric/ma.py
@@ -11,7 +11,10 @@
 """
 from __future__ import division, absolute_import, print_function
 
-import types, sys
+import sys
+import types
+import warnings
+from functools import reduce
 
 import numpy.core.umath as umath
 import numpy.core.fromnumeric as fromnumeric
@@ -19,8 +22,13 @@
 from numpy.core.fromnumeric import amax, amin
 from numpy.core.numerictypes import bool_, typecodes
 import numpy.core.numeric as numeric
-import warnings
-from functools import reduce
+
+if sys.version_info[0] >= 3:
+    _MAXINT = sys.maxsize
+    _MININT = -sys.maxsize - 1
+else:
+    _MAXINT = sys.maxint
+    _MININT = -sys.maxint - 1
 
 
 # Ufunc domain lookup for __array_wrap__
@@ -114,15 +122,15 @@ def minimum_fill_value (obj):
     if isinstance(obj, types.FloatType):
         return numeric.inf
     elif isinstance(obj, types.IntType) or isinstance(obj, types.LongType):
-        return sys.maxint
+        return _MAXINT
     elif isinstance(obj, MaskedArray) or isinstance(obj, ndarray):
         x = obj.dtype.char
         if x in typecodes['Float']:
             return numeric.inf
         if x in typecodes['Integer']:
-            return sys.maxint
+            return _MAXINT
         if x in typecodes['UnsignedInteger']:
-            return sys.maxint
+            return _MAXINT
     else:
         raise TypeError('Unsuitable type for calculating minimum.')
 
@@ -131,13 +139,13 @@ def maximum_fill_value (obj):
     if isinstance(obj, types.FloatType):
         return -inf
     elif isinstance(obj, types.IntType) or isinstance(obj, types.LongType):
-        return -sys.maxint
+        return -_MAXINT
     elif isinstance(obj, MaskedArray) or isinstance(obj, ndarray):
         x = obj.dtype.char
         if x in typecodes['Float']:
             return -inf
         if x in typecodes['Integer']:
-            return -sys.maxint
+            return -_MAXINT
         if x in typecodes['UnsignedInteger']:
             return 0
     else:
diff --git a/tools/py3tool.py b/tools/py3tool.py
--- a/tools/py3tool.py
+++ b/tools/py3tool.py
@@ -81,7 +81,7 @@
     'raise',
     'raw_input',
     'reduce',
-#    'renames',
+    'renames',
     'repr',
     'setliteral',
     'standarderror',


Test patch: