Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add warnings about "obviously unintended" code #2814
There is an interesting discussion on the python-dev mailing list about issuing more warnings from the CPython compiler about code that will lead to errors at runtime (if executed). Serhiy Storchaka has written a proof-of-concept patch in the corresponding ticket, that handles several such cases.
Cython already rejects a few more constructs than CPython at compile time, but is otherwise quite relaxed about things that will lead to runtime errors (but that might not get executed and would therefore not necessarily fail the program).
There are many places where a compile time warning could avoid having to write tests and/or require users to run the code in order to detect problems. Cython should issue a warning for them.