Skip to content

Bad typing for Python 2.7 with unicode_literals #5098

Description

@ikonst

Consider:

from __future__ import unicode_literals
import sys

print(sys.modules['sys'])

mypy --py2 unicode_literals.py results in:

unicode_literals.py:4: error: Invalid index type "unicode" for "Dict[str, Any]"; expected type "str"

However, python2.7 unicode_literals.py results in:

<module 'sys' (built-in)>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions