Skip to content

Narrow Any in and_conditional_map#21167

Merged
hauntsaninja merged 1 commit intopython:masterfrom
hauntsaninja:narrowcondit
Apr 9, 2026
Merged

Narrow Any in and_conditional_map#21167
hauntsaninja merged 1 commit intopython:masterfrom
hauntsaninja:narrowcondit

Conversation

@hauntsaninja
Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja commented Apr 4, 2026

Prior to this, mypy's behaviour is inconsistent depending on the order of the condition or the presence of terms in the condition other than isinstance

Fixes #17100 , fixes #20363 , fixes #16462

@hauntsaninja
Copy link
Copy Markdown
Collaborator Author

tanjun is good, first homeassistant is good, second homeassistant is meh, ddtrace is good

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

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

core (https://github.com/home-assistant/core)
+ homeassistant/config.py:1045: error: Argument 1 to "add" of "set" has incompatible type "Hashable"; expected "str"  [arg-type]
+ homeassistant/components/schedule/__init__.py:393: error: Need type annotation for "data_keys" (hint: "data_keys: set[<type>] = ...")  [var-annotated]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/clients.py:3154: error: Redundant cast to "Iterable[Any]"  [redundant-cast]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/appsec/_iast/taint_sinks/ssrf.py:69: error: Argument 1 to "find" of "bytes" has incompatible type "str"; expected "Buffer | SupportsIndex"  [arg-type]
+ ddtrace/appsec/_iast/taint_sinks/ssrf.py:69: error: Argument 1 to "find" of "bytearray" has incompatible type "str"; expected "Buffer | SupportsIndex"  [arg-type]

@hauntsaninja hauntsaninja merged commit ef28d9c into python:master Apr 9, 2026
24 checks passed
@hauntsaninja hauntsaninja deleted the narrowcondit branch April 9, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant