◐ Shell
clean mode source ↗

Fix re.fullmatch POSSESSIVE_REPEAT by wvmscs · Pull Request #7187 · RustPython/RustPython

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

This PR modifies the SRE (Regex) engine to ensure explicit next-context handling when breaking to subsequent matching paths for possessive repeat and atomic group operations. The changes set toplevel = false on context objects before transitioning them, accompanied by new test cases verifying possessive repeat behavior with full-match mode.

Changes

Cohort / File(s) Summary
Engine Context Handling
crates/sre_engine/src/engine.rs
Modified four matching paths (PossessiveRepeat1, PossessiveRepeat3, ATOMIC_GROUP, PossessiveRepeat4) to explicitly set toplevel = false on next contexts before breaking to them, ensuring correct context state during transitions.
Test Coverage
crates/sre_engine/tests/tests.rs, extra_tests/snippets/stdlib_re.py
Added test cases for possessive repeat with full-match behavior, including Rust unit tests and Python integration tests verifying pattern matching on "1.25.38" with regex ([0-9]++(?:\\.[0-9]+)*+).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐰 Through patterns and repeats we hop,
With contexts clear, we'll never stop,
Each toplevel set to false with care,
Possessive matches now fair,
A bunny's regex delight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: fixing re.fullmatch handling for POSSESSIVE_REPEAT patterns, which is the primary focus of the changeset across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.