On Mon, Oct 26, 2020 at 4:35 PM Senthil Kumaran <sent...@uthcode.com> wrote:
>
> On Sat, Oct 24, 2020 at 6:18 AM Christian Heimes <christ...@python.org> wrote:
>>
>> 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.
>
> I am with Christian here.

Do you mean you are OK to remove BytesWarning from b"abc" == u"def"
and b"abc" == 42?

> Still notice a possibility of people running into this because all the 
> Python2 code is not dead yet.
> Perhaps this warning might stay for a long time.
>

I never proposed to remove it "now", but 3.11.
3.10 will become security only mode at 2022-04, and EOL at 2026-10.
But you can use Python 3.10 after EOL for porting Python 2 code,
because security fix is not required while porting.

> > BytesWarning has maintenance costs. It is not huge, but significant.
>
> Should we know by how much so that the proposal of `-b` switch can be 
> weighted against?
>

It is difficult to say "how much". We need to keep it in mind that `a
== b` is not safe even for builtin types
everytime we write a patch or review pull request. Especially, when
u"foo" and b"bar" are used as keys
of the same dict, BytesWarnings happens only when (randomized) hash collision.
It is very hard to find this bug.

Of course, there are some runtime costs too.

https://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Modules/_functoolsmodule.c#L802
https://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Objects/codeobject.c#L724
(maybe more, but I'm not sure)

Regards,
-- 
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
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/52WLUUIL2LS27R5UFYFICJH5OX3ETSTA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to