You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a problem with handling # cython: language_level=2 when language_level=3str is set globally (for example, using the compiler_directives flag of cythonize()).
For some features like division, the Python 3 semantics are used anyway.
Example:
# cython: language_level=2
def test():
ver = 3
L = [ver for ver in [2]]
print(f"effective language_level for list comprehension: {ver}")
cdef object a = 3
ver = int((a / 2) * 2)
print(f"effective language_level for division: {ver}")
gives as output
>>> test()
effective language_level for list comprehension: 2
effective language_level for division: 3
Strangely enough, the opposite (# cython: language_level=3str when language_level=2 is set globally) works correctly.
The text was updated successfully, but these errors were encountered:
There seems to be a problem with handling
# cython: language_level=2
whenlanguage_level=3str
is set globally (for example, using thecompiler_directives
flag ofcythonize()
).For some features like division, the Python 3 semantics are used anyway.
Example:
gives as output
Strangely enough, the opposite (
# cython: language_level=3str
whenlanguage_level=2
is set globally) works correctly.The text was updated successfully, but these errors were encountered: