Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[match-case] fix matching againsttyping.Callable andProtocol types.#19471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ilevkivskyi merged 23 commits intopython:masterfromrandolf-scholz:fix_match_callable
Oct 16, 2025
Merged
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
46da423
fixed match-case against typing.Callable
randolf-scholzJul 15, 2025
5fbcbed
more precise type narrowing
randolf-scholzJul 16, 2025
a5c4ebe
improve narrowing + better tests
randolf-scholzJul 17, 2025
d388ec9
added test for plain protocols
randolf-scholzJul 17, 2025
ab1e450
use `is_protocol` rather than `runtime_protocol` since the runtime-ch…
randolf-scholzJul 17, 2025
89f8350
split Callback test into two.
randolf-scholzJul 17, 2025
c5d34c9
Improved callback test by checking both against concrete implementati…
randolf-scholzJul 17, 2025
c4471a1
improved testMatchClassPatternCallable with extra check
randolf-scholzJul 17, 2025
9a3e374
Fix narrowing when current_type is `Any`.
randolf-scholzJul 17, 2025
07119e0
Merge branch 'master' into fix_match_callable
randolf-scholzJul 19, 2025
74db0aa
fixed return type using mesonbuild mypy-primer failure
randolf-scholzJul 20, 2025
143f990
check if current_type is AnyType
randolf-scholzJul 20, 2025
a3d469f
Update test-data/unit/check-python310.test
randolf-scholzJul 27, 2025
e80d658
Update mypy/checker.py
randolf-scholzJul 27, 2025
82e816c
Merge branch 'master' into fix_match_callable
randolf-scholzJul 27, 2025
6a1ad26
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]Jul 27, 2025
2011f01
Merge branch 'master' into fix_match_callable
randolf-scholzJul 28, 2025
33b1c25
Merge branch 'master' into fix_match_callable
randolf-scholzAug 4, 2025
6312730
Merge branch 'master' into fix_match_callable
randolf-scholzSep 16, 2025
df67812
Merge branch 'master' into fix_match_callable
randolf-scholzOct 6, 2025
41e59ac
Merge branch 'master' into fix_match_callable
randolf-scholzOct 11, 2025
244ad9e
updated conditional_types docstring
randolf-scholzOct 11, 2025
4a51ded
Presevre original type
ilevkivskyiOct 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, seehttps://pre-commit.ci
  • Loading branch information
@pre-commit-ci
pre-commit-ci[bot] committedJul 27, 2025
commit6a1ad26a1dabb5ee74386730dc6acc193326b225
4 changes: 1 addition & 3 deletionsmypy/checker.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8022,9 +8022,7 @@ def conditional_types(
# attempt to narrow anything. Instead, we broaden the expr to Any to
# avoid false positives
return proposed_type, default
elif not any(
type_range.is_upper_bound for type_range in proposed_type_ranges
) and (
elif not any(type_range.is_upper_bound for type_range in proposed_type_ranges) and (
# concrete subtypes
is_proper_subtype(current_type, proposed_type, ignore_promotions=True)
# structural subtypes
Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp