summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2019-08-26 18:00:43 +0300
committerHugo <hugovk@users.noreply.github.com>2019-08-26 18:23:07 +0300
commit5c02fedbe1585a8e2ae530ec34d44dc80eadd4e5 (patch)
treeeab4a93d50a3ec03edd21ee63c32cf2403251ba5
parente7c1f8e789d8ccea6034f791393a2122e1237886 (diff)
downloadnumpy-5c02fedbe1585a8e2ae530ec34d44dc80eadd4e5.tar.gz
BUG: Fix for Python 4
-rw-r--r--numpy/core/setup.py2
-rw-r--r--numpy/testing/_private/parameterized.py19
-rw-r--r--tools/npy_tempita/compat3.py2
3 files changed, 11 insertions, 12 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 338502791..5ac7752cc 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -464,7 +464,7 @@ def configuration(parent_package='',top_path=None):
moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1))
# Py3K check
- if sys.version_info[0] == 3:
+ if sys.version_info[0] >= 3:
moredefs.append(('NPY_PY3K', 1))
# Generate the config.h file from moredefs
diff --git a/numpy/testing/_private/parameterized.py b/numpy/testing/_private/parameterized.py
index a5fa4fb5e..489d8e09a 100644
--- a/numpy/testing/_private/parameterized.py
+++ b/numpy/testing/_private/parameterized.py
@@ -45,11 +45,18 @@ except ImportError:
from unittest import TestCase
-PY3 = sys.version_info[0] == 3
PY2 = sys.version_info[0] == 2
-if PY3:
+if PY2:
+ from types import InstanceType
+ lzip = zip
+ text_type = unicode
+ bytes_type = str
+ string_types = basestring,
+ def make_method(func, instance, type):
+ return MethodType(func, instance, type)
+else:
# Python 3 doesn't have an InstanceType, so just use a dummy type.
class InstanceType():
pass
@@ -61,14 +68,6 @@ if PY3:
if instance is None:
return func
return MethodType(func, instance)
-else:
- from types import InstanceType
- lzip = zip
- text_type = unicode
- bytes_type = str
- string_types = basestring,
- def make_method(func, instance, type):
- return MethodType(func, instance, type)
_param = namedtuple("param", "args kwargs")
diff --git a/tools/npy_tempita/compat3.py b/tools/npy_tempita/compat3.py
index eb890ca14..01d771345 100644
--- a/tools/npy_tempita/compat3.py
+++ b/tools/npy_tempita/compat3.py
@@ -5,7 +5,7 @@ import sys
__all__ = ['PY3', 'b', 'basestring_', 'bytes', 'next', 'is_unicode',
'iteritems']
-PY3 = True if sys.version_info[0] == 3 else False
+PY3 = True if sys.version_info[0] >= 3 else False
if sys.version_info[0] < 3: