-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix bug when narrowing union containing custom eq against custom eq #20754
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip)
+ src/pip/_internal/resolution/resolvelib/candidates.py:293: error: Item "None" of "Link | None" has no attribute "is_wheel" [union-attr]
+ src/pip/_internal/resolution/resolvelib/candidates.py:293: error: Item "None" of "Link | None" has no attribute "is_file" [union-attr]
+ src/pip/_internal/resolution/resolvelib/candidates.py:294: error: Item "None" of "Link | None" has no attribute "filename" [union-attr]
+ src/pip/_internal/resolution/resolvelib/candidates.py:305: error: Item "None" of "Link | None" has no attribute "is_wheel" [union-attr]
+ src/pip/_internal/resolution/resolvelib/candidates.py:306: error: Item "None" of "Link | None" has no attribute "is_file" [union-attr]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_examples.py: note: In function "test_scoped_id":
+ schema_salad/tests/test_examples.py:395:23: error: Argument 2 to "makerdf" has incompatible type "int | float | str | CommentedMap | CommentedSeq | None"; expected "CommentedMap | float | str | CommentedSeq" [arg-type]
+ schema_salad/tests/test_examples.py:408:23: error: Argument 2 to "makerdf" has incompatible type "int | float | str | CommentedMap | CommentedSeq | None"; expected "CommentedMap | float | str | CommentedSeq" [arg-type]
+ schema_salad/tests/test_examples.py:421:23: error: Argument 2 to "makerdf" has incompatible type "int | float | str | CommentedMap | CommentedSeq | None"; expected "CommentedMap | float | str | CommentedSeq" [arg-type]
+ schema_salad/tests/test_examples.py:434:23: error: Argument 2 to "makerdf" has incompatible type "int | float | str | CommentedMap | CommentedSeq | None"; expected "CommentedMap | float | str | CommentedSeq" [arg-type]
|
|
Oh cool, for first time primer indicates we now actually do have a place where unsoundly special casing None could make sense |
|
Tested: works. Thanks! |
Do we have an issue about this so that we will not forget? Probably makes sense to do this before the next release, so that people will not see this as a perceived regression. |
|
It is easy to make changes now, I will just open a PR for it |
In python#20754 we see some primer hits where this unsoundness is beneficial
|
Something like this should do it: #20756 |
In python#20754 we see some primer hits where this unsoundness is beneficial
|
Oh and in general I am leaving some notes for myself in #20564 |
I rewrote the logic for custom equality in #20643 . This is a soundness bug in that rewrite.
Fixes #20750