FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Narrow context fallback limitation to walrus only by ilevkivskyi · Pull Request #21294 · python/mypy · GitHub

Repository navigation

Narrow context fallback limitation to walrus only - #21294

Merged
ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-ternary-context
Apr 22, 2026
Merged

ilevkivskyi merged 1 commit into
python:masterfrom
ilevkivskyi:fix-ternary-context

Conversation

Copy link
Copy Markdown
Member

Fixes #21273

This fixes regression caused by too cautious check in assignment context fallback. Ternary expression can change binder version, but only assignment expression can have an externally visible effect. So I add a dedicated counter to track this.

Copy link
Copy Markdown
Contributor

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

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/execution/execute.py:1793: error: Unused "type: ignore" comment  [unused-ignore]

Copy link
Copy Markdown
Member Author

Primer looks good.

ilevkivskyi merged commit 2b136f0 into python:master Apr 22, 2026
24 checks passed
ilevkivskyi deleted the fix-ternary-context branch April 22, 2026 23:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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] mypy no longer detects variable type narrowing via reassignment

2 participants


Back | FazBrowse Home | New Git URL