diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-13 12:21:42 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-14 08:57:45 -0600 |
commit | c879ad8a39f2b74edcdaa05a2f2f854fb235537d (patch) | |
tree | 378c562ff234193cc7391a0f89095b693f42a42e /numpy/f2py/cfuncs.py | |
parent | 3f2c789ffd0d2e05596b15ea6cd644262f96200e (diff) | |
download | numpy-c879ad8a39f2b74edcdaa05a2f2f854fb235537d.tar.gz |
2to3: Apply types fixer.
Python 3 removes the builtin types from the types module. The types
fixer replaces such references with the builtin types where possible
and also takes care of some special cases:
types.TypeNone <- type(None)
types.NotImplementedType <- type(NotImplemented)
types.EllipsisType <- type(Ellipsis)
The only two tricky substitutions are
types.StringType <- bytes
types.LongType <- int
These are fixed up to support both Python 3 and Python 2 code by
importing the long and bytes types from numpy.compat.
Closes #3240.
Diffstat (limited to 'numpy/f2py/cfuncs.py')
-rw-r--r-- | numpy/f2py/cfuncs.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 4e61b0634..a16a07d59 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -16,15 +16,13 @@ Pearu Peterson """ from __future__ import division, absolute_import, print_function -__version__ = "$Revision: 1.75 $"[10:-1] +import sys +import copy from . import __version__ -f2py_version = __version__.version -import types -import sys -import copy -errmess=sys.stderr.write +f2py_version = __version__.version +errmess = sys.stderr.write ##################### Definitions ################## @@ -1130,7 +1128,7 @@ def buildcfuncs(): def append_needs(need,flag=1): global outneeds,needs - if type(need)==types.ListType: + if type(need)==list: for n in need: append_needs(n,flag) elif type(need)==str: @@ -1162,7 +1160,7 @@ def append_needs(need,flag=1): if need in needs: for nn in needs[need]: t=append_needs(nn,0) - if type(t)==types.DictType: + if type(t)==dict: for nnn in t.keys(): if nnn in tmp: tmp[nnn]=tmp[nnn]+t[nnn] @@ -1178,7 +1176,7 @@ def append_needs(need,flag=1): if need in needs: for nn in needs[need]: t=append_needs(nn,flag) - if type(t)==types.DictType: + if type(t)==dict: for nnn in t.keys(): if nnn in tmp: tmp[nnn]=t[nnn]+tmp[nnn] |