Skip to content

Iterable for PyGenericAlias #5876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 30, 2025

Conversation

youknowone
Copy link
Member

@youknowone youknowone commented Jun 30, 2025

Summary by CodeRabbit

  • Tests
    • Updated multiple typing-related tests to run as normal tests instead of expected failures.
    • Added a new typing-related test marked as an expected failure.

Copy link

coderabbitai bot commented Jun 30, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (5)
  • vm/src/frame.rs is excluded by none and included by none
  • vm/src/stdlib/mod.rs is excluded by none and included by none
  • vm/src/stdlib/typevar.rs is excluded by none and included by none
  • vm/src/stdlib/typing.rs is excluded by none and included by none
  • vm/src/vm/context.rs is excluded by none and included by none

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.

Walkthrough

The changes remove the @unittest.expectedFailure decorator and associated comments from multiple test methods in Lib/test/test_typing.py related to TypeVarTuple, ParamSpec, Callable, GenericAlias substitution, and other typing features. These tests are now expected to run and pass normally. Additionally, a new expected failure test method was added in the CollectionsCallableTests class.

Changes

File(s) Change Summary
Lib/test/test_typing.py Removed @unittest.expectedFailure decorators and related comments from multiple typing-related test methods; added one new expected failure test method test_errors in CollectionsCallableTests.

Possibly related PRs

  • typing ParamSpec #5837: Removes @unittest.expectedFailure decorators from multiple Lib/test/test_typing.py tests related to ParamSpec, TypeVarTuple, and other typing features.
  • Fix type_params lifetime in symboltable #5844: Removes @unittest.expectedFailure decorators from typing-related tests in Lib/test/test_typing.py, enabling previously skipped tests.
  • typing.TypeVar #5834: Removes @unittest.expectedFailure decorators from tests in Lib/test/test_typing.py related to TypeVar and other typing features.

Suggested reviewers

  • arihant2math

Poem

🐇✨
In the warren where the type checks dwell,
Many tests once marked to fail as well,
Shed their old expected fate—
Now they run, anticipate!
Hopping forward, bugs dispelled,
Typing’s garden, freshly tilled.
🌿📜


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Lib/test/test_typing.py (1)

2667-2670: Enhance the TODO comment with specific reason.

The change correctly follows the test modification guidelines by adding @unittest.expectedFailure with the required # TODO: RUSTPYTHON comment. However, consider adding a specific reason to the TODO comment to better document why this test is expected to fail in RustPython.

-    # TODO: RUSTPYTHON
+    # TODO: RUSTPYTHON: collections.abc.Callable error handling differs from typing.Callable
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f016716 and 12440db.

⛔ Files ignored due to path filters (6)
  • vm/src/builtins/genericalias.rs is excluded by none and included by none
  • vm/src/builtins/union.rs is excluded by none and included by none
  • vm/src/frame.rs is excluded by none and included by none
  • vm/src/stdlib/mod.rs is excluded by none and included by none
  • vm/src/stdlib/typing.rs is excluded by none and included by none
  • vm/src/vm/context.rs is excluded by none and included by none
📒 Files selected for processing (1)
  • Lib/test/test_typing.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.py`: Follow PEP 8 style for custom Python code Use ruff for linting Python code

**/*.py: Follow PEP 8 style for custom Python code
Use ruff for linting Python code

📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md)

List of files the instruction was applied to:

  • Lib/test/test_typing.py
`Lib/**/*.py`: Minimize modifications to CPython standard library files in the `Lib/` directory

Lib/**/*.py: Minimize modifications to CPython standard library files in the Lib/ directory

📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md)

List of files the instruction was applied to:

  • Lib/test/test_typing.py
`Lib/test/**/*.py`: NEVER comment out or delete any test code lines except for r...

Lib/test/**/*.py: NEVER comment out or delete any test code lines except for removing @unittest.expectedFailure decorators and upper TODO comments in test files
NEVER modify test assertions, test logic, or test data in test files
When a test cannot pass due to missing language features, keep it as expectedFailure and document the reason
The only acceptable modifications to test files are: 1. Removing @unittest.expectedFailure decorators and the upper TODO comments when tests actually pass 2. Adding @unittest.expectedFailure decorators when tests cannot be fixed
Add a # TODO: RUSTPYTHON comment when modifications are made to tests in Lib/test
Use unittest.skip("TODO: RustPython <reason>") or unittest.expectedFailure with # TODO: RUSTPYTHON <reason> comment in test files when skipping or marking expected failures

📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md)

List of files the instruction was applied to:

  • Lib/test/test_typing.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : The only acceptable modifications to test files are: 1. Removing `@unittest.expectedFailure` decorators and the upper TODO comments when tests actually pass 2. Adding `@unittest.expectedFailure` decorators when tests cannot be fixed
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : NEVER comment out or delete any test code lines except for removing `@unittest.expectedFailure` decorators and upper TODO comments in test files
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : When a test cannot pass due to missing language features, keep it as expectedFailure and document the reason
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : Use `unittest.skip("TODO: RustPython <reason>")` or `unittest.expectedFailure` with `# TODO: RUSTPYTHON <reason>` comment in test files when skipping or marking expected failures
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : Add a `# TODO: RUSTPYTHON` comment when modifications are made to tests in `Lib/test`
Lib/test/test_typing.py (6)

undefined

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : The only acceptable modifications to test files are: 1. Removing @unittest.expectedFailure decorators and the upper TODO comments when tests actually pass 2. Adding @unittest.expectedFailure decorators when tests cannot be fixed
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : Add a # TODO: RUSTPYTHON comment when modifications are made to tests in Lib/test
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : Use unittest.skip("TODO: RustPython <reason>") or unittest.expectedFailure with # TODO: RUSTPYTHON <reason> comment in test files when skipping or marking expected failures
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : NEVER comment out or delete any test code lines except for removing @unittest.expectedFailure decorators and upper TODO comments in test files
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : When a test cannot pass due to missing language features, keep it as expectedFailure and document the reason
</retrieved_learning>

<retrieved_learning>
Learnt from: CR
PR: RustPython/RustPython#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T10:08:48.851Z
Learning: Applies to Lib/test/**/*.py : NEVER modify test assertions, test logic, or test data in test files
</retrieved_learning>

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Run tests under miri
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Check Rust code with rustfmt and clippy
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Ensure compilation on various targets
  • GitHub Check: Check the WASM package and demo

@youknowone youknowone force-pushed the genericalias-iterable branch from 12440db to 021b8eb Compare June 30, 2025 19:02
@youknowone youknowone merged commit 334a5a7 into RustPython:main Jun 30, 2025
12 checks passed
@youknowone youknowone deleted the genericalias-iterable branch June 30, 2025 19:35
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