From 07bff3e9b8a34c85c8326525bd56b02d819a3352 Mon Sep 17 00:00:00 2001 From: Will Badart Date: Mon, 28 Jan 2019 19:45:53 -0500 Subject: [PATCH] Implement @hugovk's comments The `py36` flag now uses a tuple comparison to correctly handle future major version. The unit test file also now uses `py36` as exported by the _util module, rather than re-testing `sys.version_info`. --- Tests/test_util.py | 4 +--- src/PIL/_util.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Tests/test_util.py b/Tests/test_util.py index dc18ba1e7..6d7bfeeb0 100644 --- a/Tests/test_util.py +++ b/Tests/test_util.py @@ -4,8 +4,6 @@ from helper import unittest, PillowTestCase from PIL import _util -py36 = sys.version_info.major >= 3 and sys.version_info.minor >= 6 - class TestUtil(PillowTestCase): @@ -39,7 +37,7 @@ class TestUtil(PillowTestCase): # Assert self.assertTrue(it_is) - @unittest.skipIf(not py36, 'os.path support for Paths added in 3.6') + @unittest.skipIf(not _util.py36, 'os.path support for Paths added in 3.6') def test_path_obj_is_path(self): # Arrange from pathlib import Path diff --git a/src/PIL/_util.py b/src/PIL/_util.py index d2062cb2f..cb307050c 100644 --- a/src/PIL/_util.py +++ b/src/PIL/_util.py @@ -2,7 +2,7 @@ import os import sys py3 = sys.version_info.major >= 3 -py36 = py3 and sys.version_info.minor >= 6 +py36 = sys.version_info[0:2] >= (3, 6) if py3: def isStringType(t):