Created
August 13, 2014 13:34
-
-
Save MarcCote/8ea8bb5d31bea8d5da66 to your computer and use it in GitHub Desktop.
Problem when using fused type with class inheritance in Cython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctypedef float[:,:] float2d | |
ctypedef double[:,:] double2d | |
ctypedef fused Line: | |
float2d | |
double2d | |
cdef class Metric: | |
cdef float dist(Metric self, Line line) nogil: | |
pass | |
cdef class SubMetric(Metric): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- setup.py -- | |
import numpy as np | |
from setuptools import setup | |
from Cython.Distutils import build_ext | |
from numpy.distutils.extension import Extension | |
setup( | |
cmdclass={'build_ext': build_ext}, | |
ext_modules=[Extension("metric", | |
["metric.pyx"], | |
language='c++', | |
include_dirs=[np.get_include()]) | |
] | |
) |
Great news! Now I need to remember why I needed that for exactly ^_^.
You posted this snippet in this Cython-users group thread. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been able to compile this reproducer with Cython 0.29.23.