mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix os.get_exec_path() (code and tests) for python -bb
Catch BytesWarning exceptions.
This commit is contained in:
parent
9802b39c12
commit
38430e2dff
2 changed files with 12 additions and 5 deletions
|
@ -387,13 +387,13 @@ def get_exec_path(env=None):
|
|||
|
||||
try:
|
||||
path_list = env.get('PATH')
|
||||
except TypeError:
|
||||
except (TypeError, BytesWarning):
|
||||
path_list = None
|
||||
|
||||
if supports_bytes_environ:
|
||||
try:
|
||||
path_listb = env[b'PATH']
|
||||
except (KeyError, TypeError):
|
||||
except (KeyError, TypeError, BytesWarning):
|
||||
pass
|
||||
else:
|
||||
if path_list is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue