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

Somehow fails when run on Python-3.9.0a5 #8614

Closed
dimaqq opened this issue Apr 1, 2020 · 4 comments
Closed

Somehow fails when run on Python-3.9.0a5 #8614

dimaqq opened this issue Apr 1, 2020 · 4 comments

Comments

@dimaqq
Copy link

dimaqq commented Apr 1, 2020

mypy somehow fails when run on Python-3.9.0a5

src/aapns/connection.py:36: error: syntax error in type comment

I'm pretty sure it worked with Python-3.9.0a4 and it works with Python-3.8.2:

src/aapns/connection.py:36: error: "list" is not subscriptable, use "typing.List" instead
@dimaqq
Copy link
Author

dimaqq commented Apr 1, 2020

Simplified reproducer:

~> python3.9 -m venv test-3.9-mypy
… ~> source test-3.9-mypy/bin/activate.fish
(test-3.9-mypy) … ~> pip install mypy
Collecting mypy
  Using cached https://files.pythonhosted.org/packages/66/65/6eee965deba36e9899a96879c9ce12c93b6ffe2d154b6253b72e2408878e/mypy-0.770-py3-none-any.whl
Collecting mypy-extensions<0.5.0,>=0.4.3 (from mypy)
  Using cached https://files.pythonhosted.org/packages/5c/eb/975c7c080f3223a5cdaff09612f3a5221e4ba534f7039db34c35d95fa6a5/mypy_extensions-0.4.3-py2.py3-none-any.whl
Collecting typed-ast<1.5.0,>=1.4.0 (from mypy)
  Using cached https://files.pythonhosted.org/packages/9f/2b/fc9c56c3630ed44ead9ed74919c1e445e31bb883098d1ca7b9d2b9af7b0a/typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl
Collecting typing-extensions>=3.7.4 (from mypy)
  Using cached https://files.pythonhosted.org/packages/03/92/705fe8aca27678e01bbdd7738173b8e7df0088a2202c80352f664630d638/typing_extensions-3.7.4.1-py3-none-any.whl
Installing collected packages: mypy-extensions, typed-ast, typing-extensions, mypy
Successfully installed mypy-0.770 mypy-extensions-0.4.3 typed-ast-1.4.1 typing-extensions-3.7.4.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test-3.9-mypy) … ~> cat issue8614.py
from asyncio import Future
from dataclasses import dataclass, field
from typing import Optional


@dataclass
class Channel:
    sid: int
    fut: Optional[Future]
(test-3.9-mypy) … ~> mypy issue8614.py
issue8614.py:9: error: syntax error in type comment
Found 1 error in 1 file (checked 1 source file)
(test-3.9-mypy) … ~> python --version
Python 3.9.0a5
(test-3.9-mypy) … ~>

vs. working 3.8

~> python3.8 -m venv test-3.8-mypy
… ~> source test-3.8-mypy/bin/activate.fish
(test-3.8-mypy) … ~> pip install mypy
Collecting mypy
  Using cached https://files.pythonhosted.org/packages/8b/39/caf3165b3623233fd2b62a5ce01e652cb1a8bb82d002da423ce310e32ccb/mypy-0.770-cp38-cp38-macosx_10_9_x86_64.whl
Collecting mypy-extensions<0.5.0,>=0.4.3 (from mypy)
  Using cached https://files.pythonhosted.org/packages/5c/eb/975c7c080f3223a5cdaff09612f3a5221e4ba534f7039db34c35d95fa6a5/mypy_extensions-0.4.3-py2.py3-none-any.whl
Collecting typed-ast<1.5.0,>=1.4.0 (from mypy)
  Using cached https://files.pythonhosted.org/packages/eb/a1/7878754f86bddd8f65f452e06790d2fd393d145f13be37d7092cd7b0f60e/typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl
Collecting typing-extensions>=3.7.4 (from mypy)
  Using cached https://files.pythonhosted.org/packages/03/92/705fe8aca27678e01bbdd7738173b8e7df0088a2202c80352f664630d638/typing_extensions-3.7.4.1-py3-none-any.whl
Installing collected packages: mypy-extensions, typed-ast, typing-extensions, mypy
Successfully installed mypy-0.770 mypy-extensions-0.4.3 typed-ast-1.4.1 typing-extensions-3.7.4.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(test-3.8-mypy) … ~> cat issue8614.py
from asyncio import Future
from dataclasses import dataclass, field
from typing import Optional


@dataclass
class Channel:
    sid: int
    fut: Optional[Future]
(test-3.8-mypy) … ~> mypy issue8614.py
Success: no issues found in 1 source file
(test-3.8-mypy) … ~> python --version
Python 3.8.2
(test-3.8-mypy) … ~>

@msullivan
Copy link
Collaborator

I was able to reproduce this. Originally I installed mypy on 3.9 in a virtualenv and it passed, but when I did it in a venv it failed.

I suspect this one is going to cause me some heartburn.

@msullivan
Copy link
Collaborator

OK, I retract that claim. I can just reproduce it with no trouble.

@msullivan
Copy link
Collaborator

OK the issue is that a bunch of stuff in the AST changed. I filed #8627 to be a more specific bug for that and will close this one. Thank you!

tai271828 added a commit to tai271828/cookiecutter-python-template that referenced this issue Jan 30, 2021
mypy 0.770 is not compatible with python 3.9. The issue was fixed in 0.780 and 0.800 starts to support python 3.9 officially.

python/mypy#8614 and python/mypy#8614
tai271828 added a commit to tai271828/cookiecutter-python-template that referenced this issue Jan 30, 2021
mypy 0.770 is not compatible with python 3.9. The issue was fixed in
0.780 and 0.800 starts to support python 3.9 officially.

mypy issue 8614 and 8627
python/mypy#8614
python/mypy#8627
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

No branches or pull requests

2 participants