New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cython 3.0.1 compile time crash: None Default Value #5643
Comments
Thanks for the short reproducer. I can add that this requires |
I investigated this a little and found that we generate a type check for the default argument ( I can add a special case for |
…nt to a Python type argument. For Python int (which we turn into a plain Python object type internally to avoid Py2 int/long issues), we previously generated a type check which made the None default argument much more complex than it was. Closes cython#5643
…integer) default value to a fused type generated complex argument (which ends up as a struct). Closes cython#5643
…integer) default value to a fused type generated complex argument (which ends up as a struct). Closes cython#5643
I got the same error from this line of Python source:
The code was cythoned correctly in version 3.0.0. I changed the line to
and it cythoned correctly in 3.0.2 |
Cython 3.0.1 compile time crash: None Default Value
Cython 3.0.1 crashes during compilation when None default present AND other default values in argument.
Cython 3.0.0 does not crash when None default values are present.
Crashes in both pure python and cython code. py/pyx
Snippet of error:
Code to reproduce the behaviour:
Compiling the following code causes cython 3.0.1 to crash.
crash line
reproduce crash code
Expected behaviour
The compiler should not crash if None default value is present with other default values in function argument definition.
If default None types are not allowed, interpret as python object.
Send compile warning to user None default value assignment not allowed.
OS
Debian GNU/Linux 12 (bookworm) in Docker in WLS2 in windows
Python version
3.8.17
Cython version
3.0.1
Additional context
Cython is amazing :).
The text was updated successfully, but these errors were encountered: