Skip to content

Commit

Permalink
fix(autowrap): set cython language_level=3 in autowrap
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarbenjamin committed Jul 10, 2022
1 parent 6955428 commit a524bfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sympy/utilities/autowrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion sympy/utilities/tests/test_autowrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit a524bfe

Please sign in to comment.