Message321994
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. |
|
Date |
User |
Action |
Args |
2018-07-20 09:53:48 | Barro | set | recipients:
+ Barro |
2018-07-20 09:53:48 | Barro | set | messageid: <1532080428.61.0.56676864532.issue34165@psf.upfronthosting.co.za> |
2018-07-20 09:53:48 | Barro | link | issue34165 messages |
2018-07-20 09:53:48 | Barro | create | |
|