Skip to content

Correctly aggregate narrowing information on parent expressions#21206

Open
hauntsaninja wants to merge 3 commits intopython:masterfrom
hauntsaninja:parentfix
Open

Correctly aggregate narrowing information on parent expressions#21206
hauntsaninja wants to merge 3 commits intopython:masterfrom
hauntsaninja:parentfix

Conversation

@hauntsaninja
Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja commented Apr 12, 2026

Fixes #21204 , fixes #20596

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spark (https://github.com/apache/spark)
- python/pyspark/pandas/typedef/typehints.py:163: error: Item "str" of "str | type | dtype[Any] | ExtensionDtype" has no attribute "__args__"  [union-attr]
- python/pyspark/pandas/typedef/typehints.py:163: error: Item "type" of "str | type | dtype[Any] | ExtensionDtype" has no attribute "__args__"  [union-attr]
- python/pyspark/pandas/typedef/typehints.py:163: error: Item "dtype[Any]" of "str | type | dtype[Any] | ExtensionDtype" has no attribute "__args__"  [union-attr]
- python/pyspark/pandas/typedef/typehints.py:163: error: Item "ExtensionDtype" of "str | type | dtype[Any] | ExtensionDtype" has no attribute "__args__"  [union-attr]

altair (https://github.com/vega/altair)
- altair/vegalite/v6/api.py:5171: error: Item "UndefinedType" of "Any | Sequence[VariableParameter | TopLevelSelectionParameter | SelectionParameter] | UndefinedType" has no attribute "__iter__" (not iterable)  [union-attr]

discord.py (https://github.com/Rapptz/discord.py)
- discord/channel.py:2192: error: Incompatible return value type (got "list[VoiceChannel | StageChannel | ForumChannel | TextChannel | CategoryChannel]", expected "list[TextChannel]")  [return-value]
- discord/channel.py:2199: error: Incompatible return value type (got "list[VoiceChannel | StageChannel | ForumChannel | TextChannel | CategoryChannel]", expected "list[VoiceChannel]")  [return-value]
- discord/channel.py:2209: error: Incompatible return value type (got "list[VoiceChannel | StageChannel | ForumChannel | TextChannel | CategoryChannel]", expected "list[StageChannel]")  [return-value]
- discord/channel.py:2219: error: Incompatible return value type (got "list[VoiceChannel | StageChannel | ForumChannel | TextChannel | CategoryChannel]", expected "list[ForumChannel]")  [return-value]

jax (https://github.com/google/jax)
+ jax/_src/interpreters/pxla.py:570: error: Unused "type: ignore" comment  [unused-ignore]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[1.20 regression] narrowing failure with unrelated boolean Regression with narrowing with multiple hasattr

1 participant