Skip to content

Commit 53c7c55

Browse files
committed
Avoid loading modules from user lib dirs.
1 parent e46972b commit 53c7c55

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Lib/site.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def check_enableusersite():
262262

263263
# Copy of sysconfig._getuserbase()
264264
def _getuserbase():
265+
return None # Do not try to load stuff from user dirs to avoid contamination from system python.
265266
env_base = os.environ.get("PYTHONUSERBASE", None)
266267
if env_base:
267268
return env_base

Lib/sysconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
# NOTE: site.py has copy of this function.
108108
# Sync it when modify this function.
109109
def _getuserbase():
110+
return None # Do not try to load stuff from user dirs to avoid contamination from system python.
110111
env_base = os.environ.get("PYTHONUSERBASE", None)
111112
if env_base:
112113
return env_base

0 commit comments

Comments
 (0)