Xavier Morel <xavier.mo...@masklinn.net> added the comment:

> In normal circumstances you should never deal with BytesWarning. The -b 
> option is only used for testing your program for some possible bugs caused by 
> migration from Python 2. If your program always worked only with Python 3, 
> the -b option has no use for you.

That's technically true for perfect programs, but practically if the program is 
not tested enough it's possible for it to contain unexpected instances of 
stringifying bytes which pass by mostly unnoticed, just with garbage bits of 
output which may or may not get reported.

Noticing such cases in an existing codebase is exactly what prompted me to try 
and enable BytesWarning (and then try and filter them to just conversion 
warnings, as the category is quite noisy with somewhat uninteresting warnings), 
and then spend a while trying to understand why programmatically enabling 
BytesWarning didn't do anything.

As noted in the last paragraph it's fine if `-b` is required to enable the 
feature, I'd just like to know if it could be documented clearly as it's 
somewhat frustrating to pore over the documentation of `warnings`, 
`BytesWarning`, and `-b`, diff the state of the filters configuration, etc… and 
end up finding out from a bpo comment whether the behaviour you're observing is 
intentional or not.

----------

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

Reply via email to