`Text`, on Python 2, includes `bytes`?
typing.Text, on Python 2, maps tounicode.unicodeis automatically promoted toUnion[str, unicode], see special rules in typeshed pyi typeshed#270
The combination of these two rules means that an annotation Text now includes bytes, on Python 2.
And indeed, the below type-checks, with both pytype and mypy --python-version=2.7:
import typing
def f(x):
# (typing.Text) -> None
pass
f(b"foo")
This seems a bit odd to me. It also means that we don't have a cross-version way to express "unicode string". Should Text not do the auto-promotion, so that it only stands for unicode itself, on Python 2?