STINNER Victor <vstin...@python.org> added the comment:

While you should not do that at home ;-), it's now *technically* possible to 
change the BytesWarning flag at runtime using a a *private* *internal* API:

$ ./python
Python 3.11.0a2+ (heads/remove_asyncore:010015d2eb, Nov 11 2021,

>>> "unicode" == b"bytes"
False

# Change the internal BytesWarning flag
>>> import _testinternalcapi
>>> config=_testinternalcapi.get_config()
>>> config['bytes_warning']=1
>>> _testinternalcapi.set_config(config)

>>> "unicode" == b"bytes"
<stdin>:1: BytesWarning: Comparison between bytes and string
False

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to