feat: Sync code.py + test_code_module.py from CPython v3.13.1 by ntvinh2005 · Pull Request #6181 · RustPython/RustPython
This PR updates RustPython’s stdlib code.py and its associated tests
test_code_module.py to match CPython v3.13.1.
- Copied from CPython tag v3.13.1
- Ran with:
cargo run -- -m test -v test_code_module - 17 tests run, 11 passed, 6 failed
- Failures are expected due to known VM differences:
• SyntaxError wording
• IndentationError wording
• Unicode error mismatch
• Traceback formatting difference
As per #5529, I’m submitting the updated files as-is. Follow-up issues can be filed for the failing cases.
Important
Review skipped
Review was skipped due to path filters
⛔ Files ignored due to path filters (2)
Lib/code.pyis excluded by!Lib/**Lib/test/test_code_module.pyis excluded by!Lib/**
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
@ntvinh2005 tysm for the PR:)
Can you please update it from CPython 3.13.7 instead? (if there is any difference)
I believe you can use the following command to test your changes locally:
# this runs all of the tests (not necessary if you know which test is affected) cargo run --release --features ssl,jit -- -m test -j 1 -u all --slowest --fail-env-changed -v # this runs only the test suite named "test_whatever" (usually located at `Lib/test/test_whatever.py`) cargo run --release --features ssl,jit -- -m test -j 1 -u all --slowest --fail-env-changed -v test_whatever
For a list of all resources and more command-line options, you can execute cargo run --release --features ssl,jit -- -m test -h.
@ntvinh2005 Thank you for contributing!
Since code.rs is also recently update, please rebase it on the top of upstream/main. (Otherwise merge is also fine)
For the failing tests, you don't need to actually fix the bugs; please add @unittest.expectedFailure # TODO: RUSTPYTHON as other test files.
To update code.py, don't forget to also update Lib/test/test_code.py too.
trying merge first as partially prior work for #6595