From 941b0a5b334e043b5fb5ea694d60da0128a8a3b8 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 12 Oct 2017 11:08:05 -0400 Subject: Fixed #28708 -- Added constants to detect the Python version. --- django/utils/version.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'django/utils') diff --git a/django/utils/version.py b/django/utils/version.py index 4569abb608..7d17da318f 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -2,8 +2,18 @@ import datetime import functools import os import subprocess +import sys from distutils.version import LooseVersion +# Private, stable API for detecting the Python version. PYXY means "Python X.Y +# or later". So that third-party apps can use these values, each constant +# should remain as long as the oldest supported Django version supports that +# Python version. +PY36 = sys.version_info >= (3, 6) +PY37 = sys.version_info >= (3, 7) +PY38 = sys.version_info >= (3, 8) +PY39 = sys.version_info >= (3, 9) + def get_version(version=None): """Return a PEP 440-compliant version number from VERSION.""" -- cgit v1.3