When porting code from python2 -> python3, one of the biggest hurdles is getting all the things that used to be just str, converted to sometimes-str-sometimes-bytes.

python3 -b warns about comparisons and likely-unsafe conversions.

If -b is no longer alerting about these, what does that really mean? Is it just instrumenting the str and bytes __eq__ methods and str initializer?

Or is it somehow more thorough than that?


On Tue, Jul 19, 2022 at 4:17 PM Dan Stromberg <drsalists@gmail.com> wrote:

Hi folks.

I've been porting things from Python2 to Python3 for a while, but I just found out today about python3's -b option, which emits a warning when comparing str to bytes (or vice versa), or when converting bytes to str using the str initializer.  I noticed that it also seems to even help with dictionary keys - nice.

My question is: if -b is no longer detecting things to warn about, how much does that say about how far along your str-vs-bytes-correctness is?

Thanks.

_______________________________________________
code-quality mailing list -- code-quality@python.org
To unsubscribe send an email to code-quality-leave@python.org
https://mail.python.org/mailman3/lists/code-quality.python.org/
Member address: strombrg@gmail.com