$ cat temp.pyx
# cython: language_level=3
print("abc", "def", sep=" ,") # invalid in python 2
Compiling:
$ cythonize -i world_dep.pyx
Error compiling Cython file:
------------------------------------------------------------
...
# cython: language_level=3
print("abc", "def", sep=" ,") ^
------------------------------------------------------------
temp.pyx:4:23: Expected ')', found '='
So lanugage_level directive is not getting respected. Thus, cythonize ends up using Python 2 semantics and the error is thrown as the print statement above is invalid in Python 2.
However, including any Python statement before the print statement makes this work:
$ cat temp.pyx
# cython: language_level=3
import os
print("abc", "def", sep=" ,")
Compiling and executing:
$ cythonize -i temp.pyx; python -c "import temp"
abc, def