Skip to content
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

Fix spurious errors on builtins.open #15161

Merged
merged 1 commit into from
May 2, 2023
Merged

Conversation

hauntsaninja
Copy link
Collaborator

Fixes #14796

@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2023

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

vision (https://github.com/pytorch/vision) got 1.19x slower (34.1s -> 40.7s)

@hauntsaninja hauntsaninja marked this pull request as ready for review May 1, 2023 05:52
@ikonst
Copy link
Contributor

ikonst commented May 1, 2023

Any way to test this? (preferably in a way that clarifies the value and isn't a regression test for #14796)

@hauntsaninja
Copy link
Collaborator Author

I tested manually... I think it's a little hard to write a test, like with #14088

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified manually that this fixes the errors. Thanks!

@JukkaL JukkaL merged commit 66602fc into python:master May 2, 2023
@AlexWaygood
Copy link
Member

AlexWaygood commented May 2, 2023

I think this change may have introduced a regression. If I run mypy on typeshed's stdlib stubs, it now reports that Module "typing_extensions" has no attribute "LiteralString".

The specific commands I ran were:

  1. Checkout 66602fc in my local clone of mypy.
  2. Activate a virtual environment with an editable install of mypy pointing to my clone.
  3. cd into my local clone of typeshed.
  4. Run python tests/mypy_test.py -p3.11 stdlib.

The results of the last command are:

stdlib\builtins.pyi:57: error: Module "typing_extensions" has no attribute "LiteralString"  [attr-defined]
stdlib\builtins.pyi:453: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
stdlib\builtins.pyi:583: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]


--- exit status 1, 546 files checked ---

These errors cannot be reproduced if I run typeshed's mypy_test.py script using mypy @ b5107a9.

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.

Spurious errors on the builtin open when running mypy on mypy
4 participants