summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2021-10-16 19:16:08 (GMT)
committerGitHub <noreply@github.com>2021-10-16 19:16:08 (GMT)
commitb9cdd0fb9c463c2503a4d854bb6529a9db58fe1b (patch)
treec6ce34fda3658787cefa1b0c88721216637ba657 /Lib/site.py
parentfe0d9e22a52a10c4cbe52254b51f2d4e74d83568 (diff)
downloadcpython-b9cdd0fb9c463c2503a4d854bb6529a9db58fe1b.zip
cpython-b9cdd0fb9c463c2503a4d854bb6529a9db58fe1b.tar.gz
cpython-b9cdd0fb9c463c2503a4d854bb6529a9db58fe1b.tar.bz2
bpo-45020: Default to using frozen modules unless running from source tree. (gh-28940)
The default was "off". Switching it to "on" means users get the benefit of frozen stdlib modules without having to do anything. There's a special-case for running-in-source-tree, so contributors don't get surprised when their stdlib changes don't get used. https://bugs.python.org/issue45020
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 939893e..e129f3b 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -418,8 +418,10 @@ def setcopyright():
files, dirs = [], []
# Not all modules are required to have a __file__ attribute. See
# PEP 420 for more details.
- if hasattr(os, '__file__'):
+ here = getattr(sys, '_stdlib_dir', None)
+ if not here and hasattr(os, '__file__'):
here = os.path.dirname(os.__file__)
+ if here:
files.extend(["LICENSE.txt", "LICENSE"])
dirs.extend([os.path.join(here, os.pardir), here, os.curdir])
builtins.license = _sitebuiltins._Printer(