Fix frozenset subclass keyword arguments - #8287
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefactors ChangesFrozenset construction
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/vm/src/builtins/set.rs`:
- Around line 992-1002: Update the argument match in the subclass-instantiation
branch to add an explicit zero-positional-arguments arm that returns an empty
vector, matching the fallback used by the main branch. Keep the single-iterable
handling and TypeError for more than one positional argument unchanged.
- Around line 992-1002: Update the argument match in the frozenset subclass
constructor path to handle zero positional arguments explicitly with an empty
collection value. Keep the existing single-iterable handling and
excessive-argument TypeError behavior unchanged.
- Around line 975-1002: Update the element-selection logic in the frozenset
constructor to first derive a single optional iterable: preserve the
exact-frozenset fast path, accept one positional argument, and treat zero
positional arguments as absent while still rejecting more than one. Then perform
iterable.try_to_value(vm)? or return an empty vector once after the branches,
eliminating the duplicated extraction logic and allowing subclass construction
with only keyword arguments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 276b5a7e-2889-4764-ba5f-a4c53b02d53f
⛔ Files ignored due to path filters (1)
Lib/test/test_set.pyis excluded by!Lib/**
📒 Files selected for processing (1)
crates/vm/src/builtins/set.rs
845acfd to
e37b7c9
Compare
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_set.py (TODO: 4) dependencies: dependent tests: (no tests depend on set) Legend:
|
592806f to
3d5c9b6
Compare
|
If the CI failure bothers you, you can rebase this branch onto a fresh copy of |
Assisted-by: Codex:gpt-5.6
3d5c9b6 to
67e489b
Compare
Assisted-by: Codex:gpt-5.6
Summary
frozensetsubclass construction to match CPython’s keyword-argument behavior.__init__to receive keyword arguments whilefrozenset.__new__consumes the positional iterable.frozensetand subclasses inheritingfrozenset.__init__.frozensetinstances.TestFrozenSetSubclass.test_keywords_in_subclassby removing itsexpectedFailuremarker.Summary by CodeRabbit
frozensetconstruction by detecting the exact builtin type for a faster initialization path.frozensetinputs directly when appropriate.frozensetsubclasses, enforces “at most 1 argument” and raisesTypeErrorwhen more than one positional argument is provided.frozensetcreation to reuse the existing empty singleton instead of allocating a new one.