Skip to content

Commit ac04d74

Browse files
We no longer support Python 3.5.2 or older due to a problem with its Typing library, which is fixed in python/typing#308. The fixed typing library ships with Python 3.5.3 and newer.
1 parent f58290a commit ac04d74

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

.travis.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ os:
55
- linux # Travis does not support Python on OSX or Windows. Should we migrate to a different CI service?
66

77
python:
8-
- '3.5.2' # There have been compatibility issues with this patch version
9-
- '3.5.3'
10-
- '3.5.4'
11-
- '3.5.5'
8+
- '3.5.3' # Oldest supported version
129
- '3.5'
1310
- '3.6'
1411
- '3.7-dev' # TODO: Replace with plain "3.7" when supported by Travis

pydsdl/__init__.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,30 @@
66
import os as _os
77
import sys as _sys
88

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)
1133
_sys.exit(1)
1234

1335
__version__ = 0, 7, 3

0 commit comments

Comments
 (0)