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
When compiling some code with the always_allow_keywords directive set to true with Cython 3, Cython doesn't set the language level to 3 even though -3 is passed, and infers the language level as 3str causing the compile failure.
See logs I have attached below.
Code to reproduce the behaviour:
cython -M --fast-fail -3 --include-dir /home/runner/work/pandas/pandas/build/cp310/pandas/_libs/tslibs '-X always_allow_keywords=true' /home/runner/work/pandas/pandas/pandas/_libs/tslibs/offsets.pyx -o pandas/_libs/tslibs/offsets.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/offsets.pyx.c
/home/runner/micromamba/envs/test/lib/python3.10/site-packages/Cython/Compiler/Main.py:370: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/runner/work/pandas/pandas/pandas/_libs/tslibs/offsets.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
def get_rule_code_suffix(self) -> str:
prefix = self._get_suffix_prefix()
month = MONTH_ALIASES[self.startingMonth]
weekday = int_to_weekday[self.weekday]
return f"{prefix}-{month}-{weekday}"
Expected behaviour
Language level should be inferred as 3
OS
Ubuntu 22.04.2
Python version
3.10.11
Cython version
Cython 3.0.0b3
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks for the report. Can reproduce this. Just to make clear (since it wasn't 100% clear to me from the issue) it's the '-X ...' argument that seems to trigger it. A simple cython -3 filename.pyx looks to work fine.
when -X switch is used, directives variable contains dictionary with directives containing also language_level set to None. Hence the options dictionary with key language_level is set to None instead of 3.
Describe the bug
The -3 flag does not set language level to 3.
When compiling some code with the
always_allow_keywords
directive set to true with Cython 3, Cython doesn't set the language level to 3 even though-3
is passed, and infers the language level as3str
causing the compile failure.See logs I have attached below.
Code to reproduce the behaviour:
Expected behaviour
Language level should be inferred as 3
OS
Ubuntu 22.04.2
Python version
3.10.11
Cython version
Cython 3.0.0b3
Additional context
No response
The text was updated successfully, but these errors were encountered: