GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing github.com — Remove pathlib.PurePath.__eq__ by hauntsaninja · Pull Request #10662 · python/typeshed Conversation
Collaborator
Fixes #10661
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
This comment has been minimized.
Collaborator
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
hauntsaninja
force-pushed
the
pathlib-strict-eq
branch
from
659aa6c to
7cf01aa
Compare
This comment has been minimized.
hauntsaninja
marked this pull request as ready for review
AlexWaygood
reviewed
Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Co-authored-by: Alex Waygood <[email protected]>
AlexWaygood
approved these changes
|
|
Sounds good, I'll leave open for a bit in case anyone else chimes in! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Here is a small regression that this PR causes, FYI: currently mypy will not complain about this code (on my Windows machine, the expression evaluates to from pathlib import * PureWindowsPath("foo/bar") == Path("foo/bar") But with this PR, it will: $ mypy -c "from pathlib import *; PureWindowsPath('foo/bar') == Path('foo/bar')" --strict-equality --custom-typeshed-dir . <string>:1: error: Non-overlapping equality check (left operand type: "PureWindowsPath", right operand type: "Path") [comparison-overlap] Found 1 error in 1 file (checked 1 source file) Is the regression that important? Probably not particularly; I don't know how many people are doing this kind of comparison. But, worth noting, I think. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@AlexWaygood oh, interesting example! Definitely a false positive in terms of what the type checker thinks it's doing, but that code is pretty suspect and I'm okay with it triggering a warning of some kind — depending on your platform, it could be true that those could never be equal! So I think I'm still fine with the PR (though I'll certainly add test case and comments). We should experiment with making |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Diff from mypy_primer, showing the effect of this PR on open source code: mkosi (https://github.com/systemd/mkosi) + mkosi/kmod.py:32:16: error: Non-overlapping container check (element type: "str", container item type: "Path") [comparison-overlap] + mkosi/config.py:2012:8: error: Non-overlapping equality check (left operand type: "Optional[Path]", right operand type: "Literal['']") [comparison-overlap] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This change caught a real bug in stubtest (that was introduced by, er, me)! https://github.com/python/mypy/actions/runs/6202155467/job/16840319289?pr=16121 The first CI run on python/mypy#16121 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
comparison-overlap not triggered for pathlib.Path
There was an error while loading. Please reload this page.