diff --git a/sympy/utilities/autowrap.py b/sympy/utilities/autowrap.py index cadeb28f5357..a1dcdbb185b8 100644 --- a/sympy/utilities/autowrap.py +++ b/sympy/utilities/autowrap.py @@ -254,6 +254,8 @@ class CythonCodeWrapper(CodeWrapper): setup(ext_modules=cythonize(ext_mods, **cy_opts)) """ + _cythonize_options = {'compiler_directives':{'language_level' : "3"}} + pyx_imports = ( "import numpy as np\n" "cimport numpy as np\n\n") @@ -309,7 +311,7 @@ def __init__(self, *args, **kwargs): self._extra_compile_args = kwargs.pop('extra_compile_args', []) self._extra_compile_args.append(self.std_compile_flag) self._extra_link_args = kwargs.pop('extra_link_args', []) - self._cythonize_options = kwargs.pop('cythonize_options', {}) + self._cythonize_options = kwargs.pop('cythonize_options', self._cythonize_options) self._need_numpy = False diff --git a/sympy/utilities/tests/test_autowrap.py b/sympy/utilities/tests/test_autowrap.py index 6a03eb77fce1..8e3344864830 100644 --- a/sympy/utilities/tests/test_autowrap.py +++ b/sympy/utilities/tests/test_autowrap.py @@ -99,7 +99,7 @@ def test_cython_wrapper_compile_flags(): from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize -cy_opts = {} +cy_opts = {'compiler_directives': {'language_level': '3'}} ext_mods = [Extension( 'wrapper_module_%(num)s', ['wrapper_module_%(num)s.pyx', 'wrapped_code_%(num)s.c'],