Author xiang.zhang
Recipients serhiy.storchaka, xiang.zhang
Date 2018-02-25.05:22:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519536125.53.0.467229070634.issue32943@psf.upfronthosting.co.za>
In-reply-to
Content
rot13 codec does a str translate operation. But it doesn't check the input type and then the error message would be quite confusing, especially for bytes:

>>> codecs.encode(b'abc', 'rot13')
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/rot_13.py", line 15, in encode
    return (input.translate(rot13_map), len(input))
TypeError: a bytes-like object is required, not 'dict'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: encoding with 'rot13' codec failed (TypeError: a bytes-like object is required, not 'dict')
History
Date User Action Args
2018-02-25 05:22:05xiang.zhangsetrecipients: + xiang.zhang, serhiy.storchaka
2018-02-25 05:22:05xiang.zhangsetmessageid: <1519536125.53.0.467229070634.issue32943@psf.upfronthosting.co.za>
2018-02-25 05:22:05xiang.zhanglinkissue32943 messages
2018-02-25 05:22:04xiang.zhangcreate