This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients methane, serhiy.storchaka, vstinner, xmorel
Date 2021-08-07.16:20:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628353247.89.0.0229562956124.issue43526@roundup.psfhosted.org>
In-reply-to
Content
> And though I did not check, I expect the `-b` flag exists mostly because of the performance impact of the warning any time bytes are checked for equality, but surely that impact would be limited and probably not very relevant for the stringification of bytes and that could (eventually) be moved out of the `-b` flag and to the regular warnings system?

If working Python 3 program suddenly became emitting BytesWarning it will confuse users.

Finally we will get rid of the -b option and BytesWarning. str() for bytes object will be equal to repr(), without warnings and errors. If you want to change it, use -b. Maybe introducing PYTHONBYTESWARNING will help. But I do not think we should change the behavior for these who do not ask for it specially if it will differ from the future behavior.

> Right but what about the ability to enable warning on stringification without enabling the warning on comparison?

I think it would work. But it is significant amount of work (add corresponding C API, parsing and copying code, documentation, tests), and for small benefit. Would not be better to filter out warnings by message?

I think that adding PYTHONBYTESWARNING can help you.
History
Date User Action Args
2021-08-07 16:20:47serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, methane, xmorel
2021-08-07 16:20:47serhiy.storchakasetmessageid: <1628353247.89.0.0229562956124.issue43526@roundup.psfhosted.org>
2021-08-07 16:20:47serhiy.storchakalinkissue43526 messages
2021-08-07 16:20:47serhiy.storchakacreate