You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bytearray.extend does not handle errors during iteration. #81598
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-06-26.20:17:31.538>created_at=<Date2019-06-26.18:21:02.865>labels= ['interpreter-core', '3.8', 'type-bug', '3.7', '3.9']
title='bytearray.extend does not handle errors during iteration.'updated_at=<Date2019-06-26.22:22:41.667>user='https://github.com/brandtbucher'
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.
Activity
brandtbucher commentedon Jun 26, 2019
bytearray.extend doesn't properly handle errors that arise during iteration of the argument:
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.
serhiy-storchaka commentedon Jun 26, 2019
New changeset 2a7d596 by Serhiy Storchaka (Brandt Bucher) in branch 'master':
bpo-37417: Fix error handling in bytearray.extend. (GH-14407)
2a7d596
miss-islington commentedon Jun 26, 2019
New changeset 7675bca by Miss Islington (bot) in branch '3.7':
bpo-37417: Fix error handling in bytearray.extend. (GH-14407)
7675bca
miss-islington commentedon Jun 26, 2019
New changeset 5c4ce3e by Miss Islington (bot) in branch '3.8':
bpo-37417: Fix error handling in bytearray.extend. (GH-14407)
5c4ce3e