Created
April 18, 2014 19:36
-
-
Save synapticarbors/11060931 to your computer and use it in GitHub Desktop.
Compile error under master branch of Cython but not v0.19.2
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
| import numpy as np | |
| cimport numpy as np | |
| cdef unsigned int fix |
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
| class BFact: | |
| def run(self, indx): | |
| return 0.0 | |
| cpdef set_fix(unsigned int n_fix): | |
| global fix | |
| fix = n_fix |
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
| from base import * | |
| from base cimport * | |
| class thisfact(BFact): | |
| def run(self, np.int32_t indx): | |
| return 2.0 * indx |
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
| from distutils.core import setup | |
| from distutils.extension import Extension | |
| from Cython.Build import cythonize | |
| import Cython.Compiler.Options | |
| import os, glob | |
| import numpy | |
| numpy_include = numpy.get_include() | |
| bitf = '-mno-ms-bitfields' | |
| _include = ['.', numpy_include] | |
| _extra = ['-O3', '-w', bitf] | |
| extensions = [] | |
| _module = 'base' | |
| extensions.append( | |
| Extension(_module, ['{}.pyx'.format(_module)], | |
| #depends=_depends, | |
| include_dirs=_include, | |
| extra_compile_args=_extra)) | |
| _depends = ['base.pxd'] | |
| setup( | |
| name = "", | |
| ext_modules = cythonize(extensions), | |
| ) | |
| extensions = [] | |
| filenames = glob.glob('f[0-9][0-9][0-9][0-9].pyx') | |
| for filename in filenames: | |
| _module = os.path.basename(filename)[:-4] | |
| extensions.append( | |
| Extension(_module, ['{}.pyx'.format(_module)], | |
| depends=_depends, | |
| include_dirs=_include, | |
| extra_compile_args=_extra)) | |
| cy_extensions = cythonize(extensions) | |
| setup( | |
| name = "", | |
| ext_modules = cy_extensions | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment