New submission from Jussi Judin <jjudin+pyt...@iki.fi>:
uu.decode() function can leak the internal binascii.Error exception from binascii.a2b_uu() function call instead of the documented uu.Error exception. Following code demonstrates the issue: >>> import uu >>> with open("in.uu", "wb") as fp: ... fp.write(b'begin 0 \n0\xe8') >>> uu.decode("in.uu", "out.uu") Traceback (most recent call last): File "/tmp/python-3.7-bin/lib/python3.7/uu.py", line 148, in decode data = binascii.a2b_uu(s) binascii.Error: Illegal char During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tmp/python-3.7-bin/lib/python3.7/uu.py", line 152, in decode data = binascii.a2b_uu(s[:nbytes]) binascii.Error: Illegal char It looks like the the workaround for broken encoders that catches the first binascii.Error exception just lets the second one to propagate if the recovery fails. I would except uu.Error to be raised instead, as that is mentioned in the documentation. ---------- components: Library (Lib) messages: 321994 nosy: Barro priority: normal severity: normal status: open title: uu.decode() raises binascii.Error instead of uu.Error on invalid data versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34165> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com