diff -r e1dfecfcfa04 Lib/site.py --- a/Lib/site.py Mon Nov 07 23:15:10 2016 -0500 +++ b/Lib/site.py Tue Nov 08 13:44:21 2016 +0100 @@ -422,13 +422,12 @@ sys.__interactivehook__ = register_readline -CONFIG_LINE = r'^(?P(\w|[-_])+)\s*=\s*(?P.*)\s*$' + def venv(known_paths): global PREFIXES, ENABLE_USER_SITE - env = os.environ - if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env: + if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in os.environ: executable = os.environ['__PYVENV_LAUNCHER__'] else: executable = sys.executable @@ -445,8 +444,6 @@ ] if candidate_confs: - import re - config_line = re.compile(CONFIG_LINE) virtual_conf = candidate_confs[0] system_site = "true" # Issue 25185: Use UTF-8, as that's what the venv module uses when @@ -454,10 +451,10 @@ with open(virtual_conf, encoding='utf-8') as f: for line in f: line = line.strip() - m = config_line.match(line) - if m: - d = m.groupdict() - key, value = d['key'].lower(), d['value'] + line_fields = line.split('=', 1) + if len(line_fields) == 2: + key = line_fields[0].rstrip().lower() + value = line_fields[1].lstrip() if key == 'include-system-site-packages': system_site = value.lower() elif key == 'home':