-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
mesondata: fix mypy warnings #15349
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
base: master
Are you sure you want to change the base?
mesondata: fix mypy warnings #15349
Conversation
|
I think this is a typeshed issue |
c4d7ade to
95a9311
Compare
|
@eli-schwartz: updated with an ignore because this is a bad warning from a bug in typeshed. |
|
Nice. |
|
Seems to need tweaking. |
|
Yeah, I think we need to have a version check instead of a |
|
IIRC I wrote this and did it this way because a simple version check was wrong -- older versions of python didn't support the good path, and newer versions of python support the good path only when not running from a zipapp install. Trying to remember the details of what the thought process was... |
Mypy is wrong, because typeshed is wrong, this is just fine. We do need to add a version check, because mypy doesn't understand that the code inside the try can fail, and that's fine. The try/except remains, as it is needed for the zipapp case.
95a9311 to
566d844
Compare
| except AttributeError: | ||
| # fall through to python 3.7 compatible code | ||
| pass | ||
| if sys.version_info >= (3, 10): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be fine with 3.9 too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error in the previous lint run was occurring for 3.7 and 3.8 only -- and it said "files() doesn't exist".
Mypy is wrong because typeshed is wrong.