Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2a7d596f
Commit
2a7d596f
authored
Jun 26, 2019
by
Brandt Bucher
Committed by
Serhiy Storchaka
Jun 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37417: Fix error handling in bytearray.extend. (GH-14407)
parent
5150d327
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
Lib/test/test_builtin.py
Lib/test/test_builtin.py
+5
-0
Misc/NEWS.d/next/Core and Builtins/2019-06-26-18-41-00.bpo-37417.VsZeHL.rst
...ore and Builtins/2019-06-26-18-41-00.bpo-37417.VsZeHL.rst
+2
-0
Objects/bytearrayobject.c
Objects/bytearrayobject.c
+4
-0
No files found.
Lib/test/test_builtin.py
View file @
2a7d596f
...
...
@@ -1592,6 +1592,11 @@ class BuiltinTest(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
x
.
translate
,
b"1"
,
1
)
self
.
assertRaises
(
TypeError
,
x
.
translate
,
b"1"
*
256
,
1
)
def
test_bytearray_extend_error
(
self
):
array
=
bytearray
()
bad_iter
=
map
(
int
,
"X"
)
self
.
assertRaises
(
ValueError
,
array
.
extend
,
bad_iter
)
def
test_construct_singletons
(
self
):
for
const
in
None
,
Ellipsis
,
NotImplemented
:
tp
=
type
(
const
)
...
...
Misc/NEWS.d/next/Core and Builtins/2019-06-26-18-41-00.bpo-37417.VsZeHL.rst
0 → 100644
View file @
2a7d596f
:meth:`bytearray.extend` now correctly handles errors that arise during iteration.
Patch by Brandt Bucher.
\ No newline at end of file
Objects/bytearrayobject.c
View file @
2a7d596f
...
...
@@ -1698,6 +1698,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *iterable_of_ints)
}
Py_DECREF
(
bytearray_obj
);
if
(
PyErr_Occurred
())
{
return
NULL
;
}
Py_RETURN_NONE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment