Skip to content

Instantly share code, notes, and snippets.

@synapticarbors
Created April 18, 2014 19:36
Show Gist options
  • Save synapticarbors/11060931 to your computer and use it in GitHub Desktop.
Save synapticarbors/11060931 to your computer and use it in GitHub Desktop.
Compile error under master branch of Cython but not v0.19.2
import numpy as np
cimport numpy as np
cdef unsigned int fix
class BFact:
def run(self, indx):
return 0.0
cpdef set_fix(unsigned int n_fix):
global fix
fix = n_fix
from base import *
from base cimport *
class thisfact(BFact):
def run(self, np.int32_t indx):
return 2.0 * indx
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