From 8c9cd5a3d466487c54440a47c8c04959e736aae0 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 12 Oct 2013 00:24:55 +0200 Subject: Issue #19205: Don't import the 're' module in site and sysconfig module to to speed up interpreter start. --- Lib/site.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Lib/site.py') diff --git a/Lib/site.py b/Lib/site.py index 4ac2860003..d60f15bc33 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -70,7 +70,6 @@ ImportError exception, it is silently ignored. import sys import os -import re import builtins import _sitebuiltins @@ -436,8 +435,7 @@ def aliasmbcs(): encodings._cache[enc] = encodings._unknown encodings.aliases.aliases[enc] = 'mbcs' - -CONFIG_LINE = re.compile(r'^(?P(\w|[-_])+)\s*=\s*(?P.*)\s*$') +CONFIG_LINE = r'^(?P(\w|[-_])+)\s*=\s*(?P.*)\s*$' def venv(known_paths): global PREFIXES, ENABLE_USER_SITE @@ -460,6 +458,8 @@ def venv(known_paths): ] if candidate_confs: + import re + config_line = re.compile(CONFIG_LINE) virtual_conf = candidate_confs[0] system_site = "true" with open(virtual_conf) as f: -- cgit v1.2.1