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 brandtbucher
Recipients brandtbucher
Date 2019-06-26.18:21:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561573262.89.0.0901150232643.issue37417@roundup.psfhosted.org>
In-reply-to
Content
bytearray.extend doesn't properly handle errors that arise during iteration of the argument:

Python 3.9.0a0 (heads/master:5150d32, Jun 26 2019, 10:55:32) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> array = bytearray()
>>> bad_iter = map(int, "X")
>>> array.extend(bad_iter)
ValueError: invalid literal for int() with base 10: 'X'

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: <method 'extend' of 'bytearray' objects> returned a result with an error set

As far as I can tell, this bug is present on all versions of Python 3. I've attached a patch with a fix and a regression test.
History
Date User Action Args
2019-06-26 18:21:02brandtbuchersetrecipients: + brandtbucher
2019-06-26 18:21:02brandtbuchersetmessageid: <1561573262.89.0.0901150232643.issue37417@roundup.psfhosted.org>
2019-06-26 18:21:02brandtbucherlinkissue37417 messages
2019-06-26 18:21:02brandtbuchercreate