Thanks. I think I might like an option to disable str(bytes) without
disabling str != bytes. Unless the second operation would also corrupt
output.
Came across this kind of set in the hyper http library which uses a set to
accept certain headers with either str or bytes keys.
On Tue, Jun 18, 2019, 13:05 Christian Heimes
On 18/06/2019 18.32, Daniel Holth wrote:
set([u"foo", b"foo]) will error because the two kinds of string have the same hash, and this causes a comparison. Is that correct?
Yes, it will fail with -bb, because it turns comparison between str and bytes into an error. This can also happen with other strings when hash(u'somestring') & mask == hash(b'otherbytes') & mask. The mask of a set starts with PySet_MINSIZE - 1 == 8 and increases over team.
Christian
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@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/ZIF2MRBW...