This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Barro
Recipients Barro
Date 2018-07-20.09:53:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532080428.61.0.56676864532.issue34165@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-07-20 09:53:48Barrosetrecipients: + Barro
2018-07-20 09:53:48Barrosetmessageid: <1532080428.61.0.56676864532.issue34165@psf.upfronthosting.co.za>
2018-07-20 09:53:48Barrolinkissue34165 messages
2018-07-20 09:53:48Barrocreate