New submission from Xiang Zhang <angwe...@126.com>: 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') ---------- messages: 312775 nosy: serhiy.storchaka, xiang.zhang priority: normal severity: normal status: open title: confusing error message for rot13 codec type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32943> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com