KEMBAR78
fix crash issue when using shadowfile with pretty #17853 by changhoetyng · Pull Request #17894 · python/mypy · GitHub
Skip to content

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

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

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!

@github-actions
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