|
6 | 6 | import os as _os
|
7 | 7 | import sys as _sys
|
8 | 8 |
|
9 |
| -if _sys.version_info[:2] < (3, 5): # pragma: no cover |
10 |
| - print('A newer version of Python is required', file=_sys.stderr) |
| 9 | +# The original intent was to support Python 3.5 and newer; however, we have discovered a bug in the static typing |
| 10 | +# library in Python 3.5.2 which makes the library quite unusable: when importing, the typing module would throw |
| 11 | +# "TypeError: This Callable type is already parameterized." from the expression module. The problem does not appear |
| 12 | +# in Python 3.5.3 or any newer versions; it is fixed in the upstream here: https://github.com/python/typing/pull/308. |
| 13 | +# This is how you can reproduce it in REPL; first, the correct behavior that can be observed in Python 3.5.3+: |
| 14 | +# >>> import typing |
| 15 | +# >>> T = typing.TypeVar('T') |
| 16 | +# >>> G = typing.Callable[[], T] |
| 17 | +# >>> G[int] |
| 18 | +# typing.Callable[[], int] |
| 19 | +# And this is what you get in Python 3.5.2-: |
| 20 | +# >>> import typing |
| 21 | +# >>> T = typing.TypeVar('T') |
| 22 | +# >>> G = typing.Callable[[], T] |
| 23 | +# >>> G[int] |
| 24 | +# Traceback (most recent call last): |
| 25 | +# File "<stdin>", line 1, in <module> |
| 26 | +# File "/usr/lib/python3.5/typing.py", line 815, in __getitem__ |
| 27 | +# raise TypeError("This Callable type is already parameterized.") |
| 28 | +# TypeError: This Callable type is already parameterized. |
| 29 | +_min_supported_python_version = 3, 5, 3 |
| 30 | +if _sys.version_info[:3] < _min_supported_python_version: # pragma: no cover |
| 31 | + print('This package requires a Python version', '.'.join(map(str, _min_supported_python_version)), 'or newer', |
| 32 | + file=_sys.stderr) |
11 | 33 | _sys.exit(1)
|
12 | 34 |
|
13 | 35 | __version__ = 0, 7, 3
|
|
0 commit comments