Skip to content

Somehow fails when run on Python-3.9.0a5 #8614

Closed

Description

@dimaqq

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

Activity

  1. dimaqq commented on Apr 1, 2020

    @dimaqq
    Author

    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) … ~>
  2. msullivan commented on Apr 3, 2020

    @msullivan
    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.

  3. msullivan commented on Apr 3, 2020

    @msullivan
    Collaborator

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

  4. msullivan commented on Apr 3, 2020

    @msullivan
    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!

  5. added a commit that references this issue on Dec 7, 2020
  6. added a commit that references this issue on Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions