Repository navigation
Fix disabled stream identity and conditional annotation operand checks - #8960
Conversation
Return the context's canonical None singleton when standard streams are disabled. Check the exact set type before accessing user-rebindable conditional-annotation tracking objects. Both fixes apply to the unchanged Python 3.14 target. Include the no-stdio embedding regression and the unchanged canonical regression from CPython's 3.14 maintenance backport c21e7c45, after the vulnerable 3.14.7 tag. Extracted from the larger 3.15 migration; no marshal or version changes. Assisted-by: Codex:model-version-unavailable
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ 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 |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/typing.py dependencies:
dependent tests: (19 tests)
Legend:
|
|
|
||
| class RegressionTests(unittest.TestCase): | ||
| # gh-154902 | ||
| def test_conditional_annotations_rebound(self): |
There was a problem hiding this comment.
is this test originated from CPython? otherwise do not directly edit Lib/ files
There was a problem hiding this comment.
Yes. This is copied verbatim from CPython's official 3.14 maintenance backport c21e7c45, including the accompanying import itertools. The test body, input values, and assertions are unchanged. The only difference is placement within RegressionTests: this PR inserts it before the existing tests, while upstream appended it after test_complex_comprehension_inlining.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Two existing Python 3.14 paths violate runtime object contracts: disabling standard I/O creates fresh None objects, and conditional-annotation tracking assumes a user-rebindable global is an exact set.
Return the context's None singleton for all six disabled stream attributes, and validate the set operand before adding an annotation name. Include an embedding regression that actually runs without the
stdiofeature, and the unchanged canonical annotation regression from CPython's 3.14 maintenance backport.Extracted from #8954 onto main
f39b054b9c8cbbf884f53123eef028131789990c, retaining the unchanged Python 3.14 target. The mega PR retains these fixes until they are merged independently. No marshal or Python 3.15 behavior is included.Fresh standalone validation on
8aeae47903cd431fcb31237597ae216c80512f65:no_stdio_streams_are_none_singletonexecuted and passed (1 test); default builds compile it outtest_type_annotations: 49 run /1 skipped;test_setcomps: 2 run;test_site: 43 run /6 skipped. All complete successfullysyntax_annotations_locals.pyandbuiltin_set.pypassThe official annotation backport commit
c21e7c45a9770fba9ea3b8d5abb52c19274a08efis after CPython 3.14.7. The released 3.14.7 reference still crashes on that exact canonical regression; this is a maintenance fix, not a claim that the vulnerable released tag passes. The corrected native regression passes; the reference crash was not repeated.AI assistance: prepared, reviewed and tested with Codex at the user's direction. Exact model metadata is unavailable; the commit records
Assisted-by: Codex:model-version-unavailable.