Message399194
> 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. |
|
Date |
User |
Action |
Args |
2021-08-07 16:20:47 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, vstinner, methane, xmorel |
2021-08-07 16:20:47 | serhiy.storchaka | set | messageid: <1628353247.89.0.0229562956124.issue43526@roundup.psfhosted.org> |
2021-08-07 16:20:47 | serhiy.storchaka | link | issue43526 messages |
2021-08-07 16:20:47 | serhiy.storchaka | create | |
|