[Numpy-svn] r8282 - trunk/numpy/f2py

numpy-svn@scip... numpy-svn@scip...
Sat Mar 6 17:58:12 CST 2010


Author: ptvirtan
Date: 2010-03-06 17:58:12 -0600 (Sat, 06 Mar 2010)
New Revision: 8282

Modified:
   trunk/numpy/f2py/cfuncs.py
Log:
3K: f2py: map PyString -> PyBytes and PyInt -> PyLong on Py3

Modified: trunk/numpy/f2py/cfuncs.py
===================================================================
--- trunk/numpy/f2py/cfuncs.py	2010-03-06 23:57:58 UTC (rev 8281)
+++ trunk/numpy/f2py/cfuncs.py	2010-03-06 23:58:12 UTC (rev 8282)
@@ -1068,6 +1068,15 @@
     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):



More information about the Numpy-svn mailing list