Hi,

Which operations are impacted by -b and -bb? str == bytes, bytes ==
str, dict lookup using str or bytes keys? 'unicode' < b'bytes' always
raises a TypeError.

Le sam. 24 oct. 2020 à 05:20, Inada Naoki <songofaca...@gmail.com> a écrit :
> 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.

os.get_exec_path() must modify temporarily warnings filters to ignore
BytesWarning when it looks for 'PATH' (unicode) or b'PATH' (bytes) in
the 'env' dictionary which may contain unicode or bytes strings.
Modifying warnings filters impact all threads which is bad.

I dislike having to workaround this annoying behavior for dict lookup
when -b or -bb is used.

I'm quite sure that almost nobody uses -b or -bb when running their
test suite or to develop. I expect that nobody uses it. According to
replies, it seems like porting Python 2 code to Python 3 is the only
use case. Python 3.9 and older can be used for that, no?

> When can we remove it? My idea is:
>
> 3.10: Deprecate the -b option.

Do you mean writing a message into stderr? Or just deprecate it in the
documentation?

> 3.11: Make the -b option no-op. Bytes warning never emits.
> 3.12: Remove the -b option.

There is no _need_ to raise an error when -b is used. The -t option
was kept even after the feature was removed (in Python 3.0 ?). -J
("used by Jython" says a comment) is a second command line option
which is silently ignored.


> BytesWarning will be deprecated in the document, but not to be removed.

I don't see what you mean here. I dislike the idea of deprecating a
feature without scheduling its removal. I don't see the point of
deprecating it in this case. I only see that as an annoyance.

I'm fine with removing the exception. If you don't plan to remove it,
just leave it unchanged (not deprecated), no?

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
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/YL4DITFFUYBNXF7EFZKO4IRZRDRMRIVP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to