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
Generated cached builtins from a fixed list rather than looking up in the interpreter #5591
Comments
Hello, I wanted to help with this issue. I'm new to open source, where would be a good place to start @da-woods ? Thank you! |
It's really just replacing one line of code in Symtab.py (linked in the question). You want to test against a list of class names (should probably live in Cython/Compiler/Builtin.py). Take the list of names from the most recent version of Python you can |
Hi @da-woods is the issue still open ?. If its still open can you please assign it to me. |
is the issue still open ?. If its still open can you please assign it to me
Feel free to send a PR.
|
I tried to fix this issue and opened PR #6043 . I added the |
I just noticed one issue with this approach. When new builtins are added and users refer to them in their code, we will generate code to look them up at module init time. On Python versions that don't have them, this will fail. Even if users were referring to them conditionally, e.g. based on a Python version check, the module import will still fail because we are always looking up the builtins that we find, not just the ones that are actually (conditionally or not) used at runtime. Maybe we should have a second list of builtins for which we ignore lookup failures at module init time, and then allow those globals to be EDIT: Someone stole my time machine keys. Probably myself, in the future. There's already a |
Given that the |
Originally posted by @scoder in #5589 (comment)
See https://github.com/cython/cython/blob/6776c96f66fc799c62be4d6d4022903a5e36cbb2/Cython/Compiler/Symtab.py#L1186C13-L1186C13 for where we do it.
This is more important in Symtab (where it affects code generation) than in the issue this was first discussed in (where it would effect warnings only)
The text was updated successfully, but these errors were encountered: