On 24/10/2020 05.19, Inada Naoki wrote: > Hi, all. > > To avoid BytesWarning, the compiler needs to do some hack when they > need to store bytes and str constants in one dict or set. > BytesWarning has maintenance costs. It is not huge, but significant. > > When can we remove it? My idea is: > > 3.10: Deprecate the -b option. > 3.11: Make the -b option no-op. Bytes warning never emits. > 3.12: Remove the -b option. > > BytesWarning will be deprecated in the document, but not to be removed. > Users who want to use the -b option during 2->3 conversion need to use > Python ~3.10 for a while.
In my experience it would be useful to keep the bytes warning for implicit representation of bytes in string formatting. It's still a common source of issues in code. Bytes / str comparison or dict lookup is a less common issue. >>> b = b'bytes' >>> f"{b}" Traceback (most recent call last): File "<stdin>", line 1, in <module> BytesWarning: str() on a bytes instance >>> str(b) Traceback (most recent call last): File "<stdin>", line 1, in <module> BytesWarning: str() on a bytes instance Christian _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/M2NJZTGLUA5IAGYDJZOZCPOL4AIXKMY6/ Code of Conduct: http://python.org/psf/codeofconduct/