summaryrefslogtreecommitdiff
path: root/numpy/f2py/crackfortran.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-13 12:21:42 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-14 08:57:45 -0600
commitc879ad8a39f2b74edcdaa05a2f2f854fb235537d (patch)
tree378c562ff234193cc7391a0f89095b693f42a42e /numpy/f2py/crackfortran.py
parent3f2c789ffd0d2e05596b15ea6cd644262f96200e (diff)
downloadnumpy-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/crackfortran.py')
-rwxr-xr-xnumpy/f2py/crackfortran.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index f60e2525c..c86a15407 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -140,12 +140,6 @@ TODO:
"""
from __future__ import division, absolute_import, print_function
-__version__ = "$Revision: 1.177 $"[10:-1]
-import platform
-from . import __version__
-f2py_version = __version__.version
-
-#
import sys
import string
import fileinput
@@ -153,8 +147,13 @@ import re
import pprint
import os
import copy
+import platform
+
+from . import __version__
from .auxfuncs import *
+f2py_version = __version__.version
+
# Global flags:
strictf77=1 # Ignore `!' comments unless line[0]=='!'
sourcecodeform='fix' # 'fix','free'
@@ -1523,7 +1522,7 @@ def postcrack2(block,tab='',param_map=None):
global f90modulevars
if not f90modulevars:
return block
- if type(block)==types.ListType:
+ if type(block)==list:
ret = []
for g in block:
g = postcrack2(g,tab=tab+'\t',param_map=param_map)
@@ -1560,7 +1559,7 @@ def postcrack(block,args=None,tab=''):
determine expression types if in argument list
"""
global usermodules,onlyfunctions
- if type(block)==types.ListType:
+ if type(block)==list:
gret=[]
uret=[]
for g in block:
@@ -1572,7 +1571,7 @@ def postcrack(block,args=None,tab=''):
gret.append(g)
return uret+gret
setmesstext(block)
- if (not type(block)==types.DictType) and 'block' not in block:
+ if (not type(block)==dict) and 'block' not in block:
raise Exception('postcrack: Expected block dictionary instead of ' + \
str(block))
if 'name' in block and not block['name']=='unknown_interface':