summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-03-14 15:52:19 (GMT)
committerGitHub <noreply@github.com>2017-03-14 15:52:19 (GMT)
commit2e4e011795d26cab1a3843383d0539c12fea2458 (patch)
tree6f46c1b22da56ee073c6ea2ed21b933a14c24ad4 /Lib/site.py
parentaa289a59ff6398110e1122877c073c9354ee53db (diff)
downloadcpython-2e4e011795d26cab1a3843383d0539c12fea2458.zip
cpython-2e4e011795d26cab1a3843383d0539c12fea2458.tar.gz
cpython-2e4e011795d26cab1a3843383d0539c12fea2458.tar.bz2
bpo-29592: site: skip abs_paths() when it's redundant (GH-167)
Call abs_paths() only if removeduppaths() changed sys.path
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 0fc9200..4f96ca9 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -522,8 +522,13 @@ def main():
"""
global ENABLE_USER_SITE
- abs_paths()
+ orig_path = sys.path[:]
known_paths = removeduppaths()
+ if orig_path != sys.path:
+ # removeduppaths() might make sys.path absolute.
+ # fix __file__ and __cached__ of already imported modules too.
+ abs_paths()
+
known_paths = venv(known_paths)
if ENABLE_USER_SITE is None:
ENABLE_USER_SITE = check_enableusersite()