Skip to content

Commit

Permalink
pythongh-104522: Fix test_subprocess failure when build Python in the…
Browse files Browse the repository at this point in the history
… root home directory

EPERM is raised when setreuid() fails.
EACCES is set in execve() when the test user has not access to sys.executable.
  • Loading branch information
serhiy-storchaka committed Jan 18, 2024
1 parent 6f4b242 commit 8fb5878
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Lib/test/test_subprocess.py
Expand Up @@ -2018,11 +2018,10 @@ def test_user(self):
user=user,
close_fds=close_fds)
except PermissionError as e: # (EACCES, EPERM)
self.assertIsNone(e.filename)
except OSError as e:
if e.errno not in (errno.EACCES, errno.EPERM):
raise
self.assertIsNone(e.filename)
if e.errno == errno.EACCES:
self.assertEqual(e.filename, sys.executable)
else:
self.assertIsNone(e.filename)
else:
if isinstance(user, str):
user_uid = pwd.getpwnam(user).pw_uid
Expand Down

0 comments on commit 8fb5878

Please sign in to comment.