[issue9636] {'key': 'value'}[b'key'] raises a BytesWarning

STINNER Victor report at bugs.python.org
Thu Aug 19 02:51:11 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I found this problem while running test_os with python -bb: there is an error on os.get_exec_path() because this function checks if b'PATH' key exists in the input dictionary. Extract of the function:

def get_exec_path(env=None):
    if env is None:
        env = environ

    try:
        path_list = env.get('PATH')
    except TypeError:
        path_list = None

    if supports_bytes_environ:
        try:
            path_listb = env[b'PATH']
        except (KeyError, TypeError):
            pass
        else:
    (...)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9636>
_______________________________________


More information about the Python-bugs-list mailing list