fix odd version comparisons (#988)

"> (3,)" works but looks like the code is checking for Python 4.

"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.

This ensures that all version_info comparisons use <, >=, ==, or !=.
This commit is contained in:
Jelle Zijlstra
2017-03-12 20:48:48 -07:00
committed by Guido van Rossum
parent 3e94c46e64
commit 984307bf45
4 changed files with 7 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ from typing import IO, Union
import sys
if sys.version_info <= (3, 2):
if sys.version_info < (3, 3):
_encodable = bytes
_decodable = bytes
elif sys.version_info[:2] == (3, 3):