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
Generate cache for builtins #6043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of tests:
I don't think we have any tests for the previous version of this feature. It's probably the sort of thing that needs to be tested by the content of the C code, which is always a little fiddly.
The way to do that is test_assert_c_code_has
or test_fail_if_c_code_has
.
036f4e4
to
95855d9
Compare
Regarding tests, I propose the following: Add a constant Add a test that compares the version to That way, we notice changes in the list of builtins through test failures and can adapt in time. EDIT: when skipping the test (on older versions), it would still be nice to print any differences in the skip message, so that it's easy to look through build logs for the list of supported/expected builtins of a specific Python version. |
95855d9
to
e9cf932
Compare
- Create a set with all attributes available in the most recent python (3.12.2) builtins. - Use this cache in Symtab.py in declare_builtin functions. Signed-off-by: Alexandra Pereira <alesilva241@gmail.com>
2468006
to
85b0be0
Compare
done!
done! But, I added the test in
I got the difference between the builtin available in the runtime env and the fixed version and printed the list of possible missing builtins if there are any. |
- add a constant with the version of CPython that we got the builtins attributes available. - add a test that will skip in case of using an older CPython version in runtime, or pass in case of the same, or newer version with same attributes. Signed-off-by: Alexandra Pereira <alesilva241@gmail.com>
85b0be0
to
211e204
Compare
After checking the errors reported by the CI, I am wondering if the environment used to run the tests could have any additional features, or even if I should use anything different than For example: ubuntu-20.04, 3.13-dev, c,cpp, --limited-api, --no-file, true, -limited_api ubuntu-20.04, 3.12, c,cpp, --limited-api, --no-file, true, -limited_api Skipping seems to be fine in the case of old versions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that we didn't keep uncachable_builtins
up to date, which holds the list of builtins that change across Python releases and thus cannot be cached globally. I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the list (and the test) includes module attributes that are not builtins.
…f version specific builtins. See #6043
Create a set with all attributes available in the most recent python (3.12.2) builtins.
Use this cache in
Symtab.py
indeclare_builtin
functions.Fix to #5591