diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 09:36:36 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 10:16:40 -0600 |
commit | ffdad17d0db1d55d39911d637c650ea0acada78b (patch) | |
tree | 1bae8a9e699c698f723bbd8d8e989361000f2a13 /numpy/core/arrayprint.py | |
parent | 688bc60658b391524c6b641e0a5e5ecd73322d02 (diff) | |
download | numpy-ffdad17d0db1d55d39911d637c650ea0acada78b.tar.gz |
2to3: Apply renames fixer.
Rename sys.maxint to sys.maxsize when the Python version is >= 3. This
change was made in Python 3 because all integers are 'long' integers and
their maximum value bears no relationship to the C type that int used to
represent. The new sys.maxsize value is the maximum value of Py_ssize_t.
This change has not led to any reported problems since the numpy 1.5
release.
Closes #3082
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 62d31b960..a0f2cfa63 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -22,6 +22,12 @@ from .umath import maximum, minimum, absolute, not_equal, isnan, isinf 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: |