diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 09:05:31 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 09:05:31 -0600 |
commit | 68338eed3ae91c9846142e088c16b63635e58178 (patch) | |
tree | adaec2f35174f838edbc932921eccac10c7c3886 /numpy/core | |
parent | 688bc60658b391524c6b641e0a5e5ecd73322d02 (diff) | |
download | numpy-68338eed3ae91c9846142e088c16b63635e58178.tar.gz |
2to3: Apply basestring fixer.
The basestring class is not defined in Python 3 and the fixer replaces
it with str. In order to have a common code base we define basestring in
numpy/compat/py3k.py to be str when the Python version is >= 3,
otherwise basestring and import it where needed. That works for most
cases, but there are a few files where the version dependent define
needs to be in the file.
Closes #3042.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/memmap.py | 2 | ||||
-rw-r--r-- | numpy/core/numeric.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 0ac153a74..a4f049f2c 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -7,7 +7,7 @@ import sys import numpy as np from .numeric import uint8, ndarray, dtype -from numpy.compat import long +from numpy.compat import long, basestring dtypedescr = dtype valid_filemodes = ["r", "c", "r+", "w+"] diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index f1cdb0409..d689982db 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -2,15 +2,16 @@ from __future__ import division, absolute_import, print_function import sys import warnings +import collections from . import multiarray from . import umath from .umath import * from . import numerictypes from .numerictypes import * -import collections if sys.version_info[0] >= 3: import pickle + basestring = str else: import cPickle as pickle |