Fixed #6438: distutils.cygwinccompiler.get_versions was trying to use a re string pattern on a bytes
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
index 5f3a389..8504371 100644
--- a/Lib/distutils/cygwinccompiler.py
+++ b/Lib/distutils/cygwinccompiler.py
@@ -359,7 +359,7 @@
return (CONFIG_H_UNCERTAIN,
"couldn't read '%s': %s" % (fn, exc.strerror))
-RE_VERSION = re.compile('(\d+\.\d+(\.\d+)*)')
+RE_VERSION = re.compile(b'(\d+\.\d+(\.\d+)*)')
def _find_exe_version(cmd):
"""Find the version of an executable by running `cmd` in the shell.
@@ -378,7 +378,9 @@
result = RE_VERSION.search(out_string)
if result is None:
return None
- return LooseVersion(result.group(1))
+ # LooseVersion works with strings
+ # so we need to decode our bytes
+ return LooseVersion(result.group(1).decode())
def get_versions():
""" Try to find out the versions of gcc, ld and dllwrap.