STINNER Victor added the comment:

On Python 3, comparison between str and bytes raises a BytesWarning exception 
if python3 is started with -bb. But sometimes, you really want to compare str 
with bytes. For example, os.get_exec_path() changes temporarely the 
BytesWarning warning for that!

    # {b'PATH': ...}.get('PATH') and {'PATH': ...}.get(b'PATH') emit a
    # BytesWarning when using python -b or python -bb: ignore the warning
    with warnings.catch_warnings():
        warnings.simplefilter("ignore", BytesWarning)
        ...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to