◐ Shell
clean mode source ↗

Message 241802 - Python tracker

bytes.__str__ can already raise either a warning (-b) 

    >>> str('abcäöü'.encode('utf-8'))
    __main__:1: BytesWarning: str() on a bytes instance
    "b'abc\\xc3\\xa4\\xc3\\xb6\\xc3\\xbc'"

or error (-bb), which applies equally to implicit conversion by print():

    >>> print('abcäöü'.encode('utf-8'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    BytesWarning: str() on a bytes instance