Skip to content

[ty] Fix panic on fuzzed slice expression in comprehension#23146

Merged
sharkdp merged 1 commit intomainfrom
charlie/fix-2317-comprehension-assignment-leak
Feb 9, 2026
Merged

[ty] Fix panic on fuzzed slice expression in comprehension#23146
sharkdp merged 1 commit intomainfrom
charlie/fix-2317-comprehension-assignment-leak

Conversation

@charliermarsh
Copy link
Member

Summary

Clear the assignment stack when entering a comprehension scope so that outer assignment context (e.g., an AnnAssign from error-recovered AST) cannot leak into the inner scope and create definitions that reference expressions recorded in a different scope's uses_map.

Closes astral-sh/ty#2317.

Clear the assignment stack when entering a comprehension scope so that
outer assignment context (e.g., an `AnnAssign` from error-recovered AST)
cannot leak into the inner scope and create definitions that reference
expressions recorded in a different scope's `uses_map`.

Closes astral-sh/ty#2317

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@charliermarsh charliermarsh added ty Multi-file analysis & type inference bug Something isn't working labels Feb 8, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 8, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 8, 2026

mypy_primer results

Changes were detected when running on open source projects
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `Unknown | Coroutine[Any, Any, Unknown]`
+ src/prefect/input/run_input.py:672:20: error[invalid-return-type] Return type does not match returned value: expected `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]`, found `T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler] | Coroutine[Any, Any, T@GetAutomaticInputHandler | AutomaticRunInput[T@GetAutomaticInputHandler]]`

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/mz_workload_anonymize.py:251:13: error[no-matching-overload] No overload of bound method `join` matches arguments
- Found 534 diagnostics
+ Found 535 diagnostics

sympy (https://github.com/sympy/sympy)
+ sympy/parsing/mathematica.py:692:38: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | list[Unknown | str]`
- Found 15906 diagnostics
+ Found 15907 diagnostics

No memory usage changes detected ✅

@charliermarsh charliermarsh marked this pull request as ready for review February 9, 2026 01:29
@sharkdp sharkdp self-assigned this Feb 9, 2026
Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Thank you

@sharkdp sharkdp merged commit c430e60 into main Feb 9, 2026
52 checks passed
@sharkdp sharkdp deleted the charlie/fix-2317-comprehension-assignment-leak branch February 9, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic: no entry found for key with fuzzed slice expression

2 participants