Skip to content

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Jan 18, 2026

probably related to #6762

Summary by CodeRabbit

  • New Features
    • Improved warnings module initialization on RustPython CLI startup with robust error handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@youknowone youknowone requested a review from fanninpm January 18, 2026 03:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

The RustPython CLI startup flow now includes early initialization of the warnings module via explicit import in run_rustpython. If the import fails, the error is logged. This replaces a previous placeholder comment for _PyWarnings_Init() with functional implementation.

Changes

Cohort / File(s) Summary
Warnings Module Initialization
src/lib.rs
Added early import of warnings module at CLI startup with error logging for import failures (+6 lines)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • RustPython/RustPython#6546: Related warnings subsystem changes that probe sys.modules and modify warning instance creation/handling

Poem

🐰 A rabbit hops through warnings so bright,
Early imports at startup's first light,
Error logs gentle, if module won't load,
Safe passage now cleared on the initialization road! 📋

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: initializing the warnings module during interpreter startup, which aligns with the changeset that adds early warnings module import in run_rustpython.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@youknowone youknowone marked this pull request as ready for review January 18, 2026 03:40
@youknowone youknowone merged commit 96e08a4 into RustPython:main Jan 18, 2026
13 checks passed
@youknowone youknowone deleted the init-warning branch January 18, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant