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

More "syntax error in type comment"s #9916

Closed
benknoble opened this issue Jan 16, 2021 · 6 comments
Closed

More "syntax error in type comment"s #9916

benknoble opened this issue Jan 16, 2021 · 6 comments
Labels
bug mypy got something wrong

Comments

@benknoble
Copy link

Bug Report

Related to #8627

To Reproduce

# cat <<DOG > some.py
import subprocess
DOG
# mypy some.py | head
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:50: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:63: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:66: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:67: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:77: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:78: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:79: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:80: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:81: error: syntax error in type comment
/Users/Knoble/Library/Python/3.9/lib/python/site-packages/mypy/typeshed/stdlib/3/subprocess.pyi:82: error: syntax error in type comment
# trimmed …

Expected Behavior

No issues

Actual Behavior

Unable to effectively sort through messages because of the ~360 from this module alone

Your Environment

  • Mypy version used: 740 and 790
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.9.1
  • Operating system and version: macOS Mojave 10.14.6 18G5033 x86_64
@benknoble benknoble added the bug mypy got something wrong label Jan 16, 2021
@hauntsaninja
Copy link
Collaborator

Expected on 0.740, but was fixed well before 0.790 (and I can't repro). Feel free to re-open if you can't get it to work, but closing since I'm quite sure you're still using an old mypy (maybe try hash -r).

@benknoble
Copy link
Author

Hm, yes, in spite of installing a fresh copy in a venv, it seems there was an issue with which mypy was used. Thank you.

@sshaikh
Copy link

sshaikh commented May 6, 2021

I'm trying to use mypy 0.812 with python 3.9.4 on Arch but am seeing these:

/home/user/.cache/pre-commit/repobrxmsytl/py_env-python3/lib/python3.9/site-packages/mypy/typeshed/stdlib/2and3/builtins.pyi:1679: error:
syntax error in type comment  [syntax]
            def truncate(self, pos: Optional[int] = ...) -> int: ...

I'm also using venv if that makes a difference?

EDIT:

My fault - fixed by updating the version of mypy being called via pre-commit.

@robbrit
Copy link

robbrit commented Oct 12, 2021

For those who have gotten this after an upgrade to Python 3.9, I was able to get things fixed with mypy==0.782.

@ethanhs
Copy link
Collaborator

ethanhs commented Oct 13, 2021

I generally would recommend running the latest mypy unless something is holding you back.

@robbrit
Copy link

robbrit commented Oct 13, 2021

In an ideal world yup, but unfortunately because of the breaking changes that get introduced in new versions of mypy, the amount of effort required to upgrade something is O(nm), n being the size of the codebase and m being the difference in versions.

LarsMichelsen pushed a commit to Checkmk/checkmk that referenced this issue Aug 17, 2022
* regarding typed-ast see: python/typed_ast#159 (comment)
* regarding mypy see: python/mypy#9916
* further: ignore "error: Unpacking a string is disallowed" -> credentials may also be a string...

Change-Id: I57daada9f8340075bf92be308310ec341a3f3d5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

5 participants