-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Handle unions with GenericAlias subclasses without TypeError #6540
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
base: main
Are you sure you want to change the base?
Conversation
|
Warning Rate limit exceeded@youknowone has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
|
Code has been automatically formatted The code in this PR has been formatted using git pull origin copilot/fix-typeerror-in-pytest |
youknowone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure test_types and test_typing working
crates/vm/src/builtins/union.rs
Outdated
| let Some(_) = module | ||
| .as_ref() | ||
| .and_then(|m| m.downcast_ref::<PyStr>()) | ||
| .filter(|m| m.as_str() == TYPING_MODULE) | ||
| else { | ||
| return false; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified unionability to allow subclasses of types.GenericAlias/types.UnionType instead of the prior typing-specific check (3b4e565).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test need to be placed in extra_tests/snippets/stdlib_typing.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the Callable union snippet into extra_tests/snippets/stdlib_typing.py and dropped the standalone file (3b4e565).
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Ran targeted suites after the fixes: |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Pytest on RustPython failed when evaluating
bool | Callable[...]because typing’s_CallableGenericAliaswasn’t accepted as unionable.types.GenericAliasandtypes.UnionTypeas valid union operands, removing the prior typing-specific check.bool | typing.Callablesnippet toextra_tests/snippets/stdlib_typing.pyto ensure the case no longer raises.Example:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.