Skip to content

contextlib.nullcontext not recognized as contextlib attribute #2676

@zhammer

Description

@zhammer

Issue

contextlib.nullcontext from 3.7 isn't recognized as an attribute of contextlib in mypy 0.650.

Reproduce

$ ls
$ pipenv install --dev mypy
Creating a Pipfile for this project…
Installing mypy…
Adding mypy to Pipfile's [dev-packages]…
...
$ echo "from contextlib import nullcontext" > file.py
$ pipenv run mypy --python-version 3.7 file.py
file.py:1: error: Module 'contextlib' has no attribute 'nullcontext'
$ pipenv run mypy -V
mypy 0.650
$ python file.py  # python3.7 interpreter works
$ python -V
Python 3.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions