Repository navigation
Preserve unpacked GenericAlias state during substitution - #9467
Conversation
Match CPython ga_getitem by retaining the starred flag when substituting generic alias parameters. Sync test_typing from the pinned CPython source with update_lib and retire the now-passing variadic substitution marker. Assisted-by: OpenAI Codex: model version unavailable
|
Caution Review failedThe pull request is closed. Finishing Touches
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 |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/typing.py dependencies:
dependent tests: (22 tests)
Legend:
|
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Preserve the unpacked (
starred) flag when substituting parameters of aGenericAlias. CPython'sga_getitemcopies this flag onto the newly created alias; RustPython was always resetting it to false.For example, substituting into an unpacked
*tuple[T]should retain the unpacked alias and its__unpacked__value rather than returning an ordinarytuple[int]alias.Lib/test/test_typing.pyusingscripts/update_lib migratefrom that pinned CPython source. The result is byte-for-byte identical upstream, retiring the variadic substitution expected-failure marker and its otherwise-unused import.Verification
cargo checkand Clippy passed.GenericAliasSubstitutionTestsmethods plustest_genericalias.BaseTest.test_unpackandtest_iter_creates_starred_tuple. No skips or expected failures in this selection.The full workspace/C-API suite and complete test_typing module were not run locally. This draft awaits normal CI for broader coverage.
Part of the Python 3.15 upgrade split from #8954. No new snippets or Rust tests of Python behavior are added.