FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix faulty casts in checker by hauntsaninja · Pull Request #10560 · python/mypy · GitHub

Repository navigation

Fix faulty casts in checker - #10560

Merged
JukkaL merged 1 commit into
python:masterfrom
hauntsaninja:crash
Jun 18, 2021
Merged

JukkaL merged 1 commit into
python:masterfrom
hauntsaninja:crash

Conversation

Copy link
Copy Markdown
Collaborator

Fixes #9615, fixes #9682

Both issue reports hit the faulty cast on L2803. This changes the logic
so that that cast is actually always true. If not, we just end up doing
whatever the fallback else clause does; this resulted in behaviour that
matched what I expected.

After that, the #9682 hit another crash in checker.py, where var.node
was None instead of a Var. It seemed reasonable to just branch instead.

Fixes python#9615, fixes python#9682

Both issue reports hit the faulty cast on L2803. This changes the logic
so that that cast is actually always true. If not, we just end up doing
whatever the fallback else clause does; this resulted in behaviour that
matched what I expected.

After that, the python#9682 hit another crash in checker.py, where var.node
was None instead of a Var. It seemed reasonable to just branch instead.
x = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "str")


[case testRedefineModuleAsException]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Note that if you run this in real life you get:

crash.py:5: error: Incompatible types in assignment (expression has type "Exception", variable has type Module)
Found 1 error in 1 file (checked 1 source file)

I think the fixtures just aren't up to scratch here.

JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good! Thanks for fixing these crashes.

JukkaL merged commit b0e36aa into python:master Jun 18, 2021
JukkaL pushed a commit that referenced this pull request Jun 21, 2021
Fixes #9615, fixes #9682

Both issue reports hit the faulty cast on L2803. This changes the logic
so that that cast is actually always true. If not, we just end up doing
whatever the fallback else clause does; this resulted in behaviour that
matched what I expected.

After that, the #9682 hit another crash in checker.py, where var.node
was None instead of a Var. It seemed reasonable to just branch instead.

Co-authored-by: hauntsaninja <>
hauntsaninja deleted the crash branch June 26, 2021 19:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants


Back | FazBrowse Home | New Git URL