Message346655
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. |
|
Date |
User |
Action |
Args |
2019-06-26 18:21:02 | brandtbucher | set | recipients:
+ brandtbucher |
2019-06-26 18:21:02 | brandtbucher | set | messageid: <1561573262.89.0.0901150232643.issue37417@roundup.psfhosted.org> |
2019-06-26 18:21:02 | brandtbucher | link | issue37417 messages |
2019-06-26 18:21:02 | brandtbucher | create | |
|