summaryrefslogtreecommitdiff
path: root/numpy/f2py/cfuncs.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2010-03-06 23:58:12 +0000
committerPauli Virtanen <pav@iki.fi>2010-03-06 23:58:12 +0000
commitb65938a4b3102118863da58df4add651fcbb5e2d (patch)
tree5e27fa5e829054d87eb9ed5c729be9ed6da4ccee /numpy/f2py/cfuncs.py
parent4a26b70fd3c0dd6b4aca063a5ba504af3e91484f (diff)
downloadnumpy-b65938a4b3102118863da58df4add651fcbb5e2d.tar.gz
3K: f2py: map PyString -> PyBytes and PyInt -> PyLong on Py3
Diffstat (limited to 'numpy/f2py/cfuncs.py')
-rw-r--r--numpy/f2py/cfuncs.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py
index e75c6e9f6..b9964c93b 100644
--- a/numpy/f2py/cfuncs.py
+++ b/numpy/f2py/cfuncs.py
@@ -1068,6 +1068,15 @@ def buildcfuncs():
cppmacros[m]='#define %s(v,dims) (PyArray_SimpleNewFromData(1,dims,PyArray_CHAR,(char *)v))'%(m)
+############ Automatic Python3 conversions ###################
+
+if sys.version_info[0] >= 3:
+ for key, value in cfuncs.items():
+ value = value.replace('PyString', 'PyBytes')
+ value = value.replace('PyInt_AS_LONG', 'PyLong_AsLong')
+ value = value.replace('PyInt', 'PyLong')
+ cfuncs[key] = value
+
############ Auxiliary functions for sorting needs ###################
def append_needs(need,flag=1):