From 13364f7775e3c79a0055fa78b4e04c9b475c6c3e Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sat, 7 Nov 2020 15:39:09 +0800 Subject: [PATCH] Fix re.ASCII usage on Python 2 --- packaging/tags.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/tags.py b/packaging/tags.py index 37dc2b7d7..3e33adc6e 100644 --- a/packaging/tags.py +++ b/packaging/tags.py @@ -21,6 +21,7 @@ import sysconfig import warnings +from ._compat import PY2 from ._typing import TYPE_CHECKING, cast if TYPE_CHECKING: # pragma: no cover @@ -846,7 +847,10 @@ def _get_host_platform(): return cast(str, aix_platform()) elif osname[:6] == "cygwin": osname = "cygwin" - rel_re = re.compile(r"[\d.]+", re.ASCII) + if PY2: # Python 2 does not have re.ASCII. + rel_re = re.compile(r"[\d.]+") + else: + rel_re = re.compile(r"[\d.]+", re.ASCII) m = rel_re.match(release) if m: release = m.group()