mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-10496: distutils check_environ() handles getpwuid() error (GH-10931)
check_environ() of distutils.utils now catchs KeyError on calling pwd.getpwuid(): don't create the HOME environment variable in this case.
This commit is contained in:
parent
e6b247c8e5
commit
17d0c0595e
3 changed files with 35 additions and 11 deletions
|
@ -157,8 +157,13 @@ def check_environ ():
|
|||
return
|
||||
|
||||
if os.name == 'posix' and 'HOME' not in os.environ:
|
||||
import pwd
|
||||
os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
|
||||
try:
|
||||
import pwd
|
||||
os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
|
||||
except (ImportError, KeyError):
|
||||
# bpo-10496: if the current user identifier doesn't exist in the
|
||||
# password database, do nothing
|
||||
pass
|
||||
|
||||
if 'PLAT' not in os.environ:
|
||||
os.environ['PLAT'] = get_platform()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue