Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

PEP544, inheriting Protocol show error: Inheriting 'Protocol', which is not a class. #2021

Closed
@potens1

Description

@potens1

Environment data

  • VS Code version: 1.44.2
  • Extension version (available under the Extensions sidebar): 2020.4.76186
  • OS and version: Arch
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.8 (but should produce the same if typing_extensions are installed)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: typing, mypy, typing_extensions
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version vscode-python#3977): same result, tried both
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

No error should be raised since it is defined in PEP Protocol must be used this way

Actual behaviour

error in Problems view:
Inheriting 'Protocol', which is not a class.

Steps to reproduce:

from PEP544

from typing import Protocol

class SupportsClose(Protocol):
    def close(self) -> None:
        ...

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Nothing relevant


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

Hemmm, coredump opening the devtool under arch, too new kernel or glibc, have to investigate if it's electron side or vscode one (but I guess nothing relevant there either)

Please, if you correct the issue, could you do it that even on python version before 3.8, if using typing_extensions it work also ? (typing extensions were used by mypy before 3.8, I think: https://mypy.readthedocs.io/en/latest/protocols.html#simple-user-defined-protocols)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions