Commit e59d4dcf authored by Stefan Behnel's avatar Stefan Behnel

Fix compilation failures with Pythran 0.8.7 by generating different code for older versions.

Also removes the usage of the header file "long.cpp" which was removed in Pythran 0.8.7.
parent e1f059e4
......@@ -8,9 +8,11 @@ import cython
try:
import pythran
_pythran_available = True
pythran_version = pythran.__version__
pythran_is_0_8_7 = pythran_version >= '0.9' or pythran_version >= '0.8.7'
except ImportError:
_pythran_available = False
pythran_version = None
pythran_is_0_8_7 = False
# Pythran/Numpy specific operations
......@@ -39,7 +41,10 @@ def pythran_type(Ty, ptype="ndarray"):
ctype = dtype.typedef_cname
else:
raise ValueError("unsupported type %s!" % dtype)
return "pythonic::types::%s<%s,%d>" % (ptype,ctype, ndim)
if pythran_is_0_8_7:
return "pythonic::types::%s<%s,pythonic::types::pshape<%s>>" % (ptype,ctype, ",".join(("Py_ssize_t",)*ndim))
else:
return "pythonic::types::%s<%s,%d>" % (ptype,ctype, ndim)
if Ty.is_pythran_expr:
return Ty.pythran_type
#if Ty.is_none:
......@@ -120,7 +125,7 @@ def np_func_to_list(func):
return []
return np_func_to_list(func.obj) + [func.attribute]
if _pythran_available:
if pythran_version:
def pythran_is_numpy_func_supported(func):
CurF = pythran.tables.MODULES['numpy']
FL = np_func_to_list(func)
......@@ -210,5 +215,5 @@ def include_pythran_generic(env):
env.add_include_file("pythonic/types/uint%d.hpp" % i)
env.add_include_file("pythonic/types/int%d.hpp" % i)
for t in ("float", "float32", "float64", "set", "slice", "tuple", "int",
"long", "complex", "complex64", "complex128"):
"complex", "complex64", "complex128"):
env.add_include_file("pythonic/types/%s.hpp" % t)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment