summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-10-11 22:24:55 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-10-11 22:24:55 (GMT)
commit8c9cd5a3d466487c54440a47c8c04959e736aae0 (patch)
tree020a0d5f7b3760b1fa92eed862f813344226a2ce /Lib/site.py
parentfd4722cacf4885c29d358b8de6718b51a8149fa3 (diff)
downloadcpython-8c9cd5a3d466487c54440a47c8c04959e736aae0.zip
cpython-8c9cd5a3d466487c54440a47c8c04959e736aae0.tar.gz
cpython-8c9cd5a3d466487c54440a47c8c04959e736aae0.tar.bz2
Issue #19205: Don't import the 're' module in site and sysconfig module to
to speed up interpreter start.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 4ac2860..d60f15b 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<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\s*$')
+CONFIG_LINE = r'^(?P<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\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: