From d906152951fb527b5ddc7576df61c66f7f706c5e Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Wed, 9 Aug 2023 13:34:55 +0200 Subject: [PATCH] platform module: Fixes interpreter version recognition the previous, human-oriented approach based on Guido's unmaterialized thought to continue with a version 4 after 3.9. --- cerberus/platform.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cerberus/platform.py b/cerberus/platform.py index 796597ce..15b1eddd 100644 --- a/cerberus/platform.py +++ b/cerberus/platform.py @@ -6,10 +6,7 @@ raise RuntimeError("Cerberus can't be run with Python's optimization level 2.") -PYTHON_VERSION = float(sys.version_info[0]) + float(sys.version_info[1]) / 10 - - -if PYTHON_VERSION < 3: +if sys.version_info < (3,): _int_types = (int, long) # noqa: F821 _str_type = basestring # noqa: F821 else: @@ -17,7 +14,7 @@ _str_type = str -if PYTHON_VERSION < 3.3: +if sys.version_info < (3, 3): from collections import ( Callable, Container, @@ -42,7 +39,7 @@ Sized, ) -if PYTHON_VERSION < 3.8: +if sys.version_info < (3, 8): import importlib_metadata else: import importlib.metadata as importlib_metadata