Skip to content

Honor warning instance categories before validating category arguments - #9034

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-warning-instance-category
Oct 10, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-warning-instance-category

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

When the warning message is already a Warning instance, use its class before validating the explicit category argument. This matches CPython 3.14 for valid, unrelated, and invalid category arguments.

Extracted from #8954 without its Python 3.15 diagnostic change. Adds only the missing instance cases to the existing warnings snippet; canonical tests retain coverage for invalid categories with ordinary messages.

Validation:

  • CPython 3.14.7 passes the focused snippet. The pre-fix RustPython baseline rejects the invalid category instead of emitting the warning instance.
  • Normal pre-commit hooks and VM Clippy pass.
  • Patched native runtime and aggregate tests await CI; local runtime linking is blocked by available disk space.

AI-assisted implementation, tests, and review with OpenAI Codex. Kept as a draft for CI and maintainer review.

Extract the Python 3.14-compatible ordering fix from RustPython#8954. An existing Warning instance determines its own category, regardless of the category argument. Keep canonical invalid-category coverage and add only the missing instance case to the existing warnings snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: afe27de7-0408-412c-a84f-87a04c3dfc51

📥 Commits

Reviewing files that changed from the base of the PR and between 3af5f8a and 88b67ee.


📒 Files selected for processing (2)
  • crates/vm/src/stdlib/_warnings.rs
  • extra_tests/snippets/stdlib_warnings.py

 ________________________________________________________________________
< Making the Death Star fully operational, with zero exhaust port flaws. >
 ------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@youknowone
youknowone marked this pull request as ready for review October 10, 2026 10:36
@youknowone
youknowone merged commit 7079e70 into RustPython:main Oct 10, 2026
21 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T10:39:08.836423Z 88b67ee Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88b67ee361

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +18 to +20
assert len(caught) == 1
assert caught[0].message is message
assert caught[0].category is CustomWarning

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the new assertions from the test file

These lines add new assertions and test logic to an existing test file, but this repository explicitly prohibits modifying test assertions, logic, or data and limits acceptable test-file edits to adding or removing expected-failure markers; this test-file portion of the commit therefore needs to be removed or handled through an approved non-test-file mechanism.

AGENTS.md reference: AGENTS.md:L275-L279

Useful? React with 👍 / 👎.

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.

2 participants