cpython: 406529adf156 (original) (raw)

Mercurial > cpython

changeset 86213:406529adf156

Issue #19205: Don't import the 're' module in site and sysconfig module to to speed up interpreter start. [#19205]

Christian Heimes christian@cheimes.de
date Sat, 12 Oct 2013 00:24:55 +0200
parents fbbf8b160e8d
children 2cd1b28d1666
files Lib/site.py Lib/sysconfig.py Lib/test/test_site.py Misc/NEWS
diffstat 4 files changed, 24 insertions(+), 4 deletions(-)[+] [-] Lib/site.py 6 Lib/sysconfig.py 4 Lib/test/test_site.py 15 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/site.py +++ b/Lib/site.py @@ -70,7 +70,6 @@ ImportError exception, it is silently ig 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:

--- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -1,7 +1,6 @@ """Access to Python's configuration information.""" import os -import re import sys from os.path import pardir, realpath @@ -222,6 +221,7 @@ def _parse_makefile(filename, vars=None) """ # Regexes needed for parsing Makefile (and similar syntaxes, # like old-style Setup files).

--- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -420,5 +420,20 @@ class ImportSideEffectTests(unittest.Tes self.assertEqual(code, 200, msg="Can't find " + url) +class StartupImportTests(unittest.TestCase): +

+

+ + if name == "main": unittest.main()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,9 @@ Core and Builtins Library ------- +- Issue #19205: Don't import the 're' module in site and sysconfig module to