Fix os.get_exec_path() (code and tests) for python -bb

Catch BytesWarning exceptions.
This commit is contained in:
Victor Stinner 2010-08-19 17:10:18 +00:00
parent 9802b39c12
commit 38430e2dff
2 changed files with 12 additions and 5 deletions

View file

@ -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: