◐ Shell
clean mode source ↗

Add regression test for #4505 by ShaharNaveh · Pull Request #6417 · RustPython/RustPython

Walkthrough

A regression test is added to extra_tests/snippets/builtin_type.py verifying that code.co_names does not leak __doc__ entries when nested functions are defined or when compiling module source strings, addressing issue #4505.

Changes

Cohort / File(s) Summary
Regression test for co_names leak
extra_tests/snippets/builtin_type.py
Adds a regression test block that verifies code.co_names excludes __doc__ entries in two scenarios: nested function definitions and compiled module code. Includes import rearrangement and formatting adjustments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

This is a straightforward test addition with minimal logic. The changes consist of a simple assertion block and formatting adjustments with no complex logic or structural modifications.

Poem

🐰 A doc was leaking where it shouldn't be,
In nested functions wild and free,
We test it now, the fix is clear,
No __doc__ shadows shall appear!
Co_names clean, hooray, hooray! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a regression test for issue #4505, which directly reflects the content of the changeset.
Linked Issues check ✅ Passed The PR adds test cases that directly match the two reproduction scenarios from issue #4505 (nested function and module compilation), fulfilling the objective to detect the __doc__ leakage regression.
Out of Scope Changes check ✅ Passed All changes are scoped to adding regression tests in builtin_type.py as requested in comments; no unrelated modifications are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.