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 crash issue when using shadowfile with pretty #17853 #17894

Merged
merged 4 commits into from
Oct 11, 2024

Conversation

changhoetyng
Copy link
Contributor

@changhoetyng changhoetyng commented Oct 7, 2024

  • Fix crash issue when using --pretty with --shadow-file

Example Scenario:
a.py

b: bytes

b.py

a: int = ""
b: bytes = 1

output

$ mypy a.py --pretty --shadow-file a.py b.py
a.py:1: error: Incompatible types in assignment (expression has type "str",
variable has type "int")
    a: int = ""
             ^~
a.py:2: error: Incompatible types in assignment (expression has type "int",
variable has type "bytes")
    b: bytes = 1
               ^

Fixes #17853

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

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.

Thanks for the PR!

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL merged commit b1701e5 into python:master Oct 11, 2024
18 checks passed
@changhoetyng changhoetyng deleted the test-#17853 branch October 14, 2024 18:27
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.

Crash in --pretty mode with --shadow-file which shadows a shorter file
2 participants