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
75c3d6ff
Commit
75c3d6ff
authored
Feb 13, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3694: fix an "XXX undetected error" leak in struct.
parent
c8dcfb6c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
Lib/test/test_struct.py
Lib/test/test_struct.py
+4
-0
Modules/_struct.c
Modules/_struct.c
+1
-1
No files found.
Lib/test/test_struct.py
View file @
75c3d6ff
...
...
@@ -524,6 +524,10 @@ class StructTest(unittest.TestCase):
self
.
assertRaises
(
struct
.
error
,
s
.
pack_into
,
small_buf
,
0
,
test_string
)
self
.
assertRaises
(
struct
.
error
,
s
.
pack_into
,
small_buf
,
2
,
test_string
)
# Test bogus offset (issue 3694)
sb
=
small_buf
self
.
assertRaises
(
TypeError
,
struct
.
pack_into
,
b'1'
,
sb
,
None
)
def
test_pack_into_fn
(
self
):
test_string
=
b'Reykjavik rocks, eow!'
writable_buf
=
array
.
array
(
'b'
,
b' '
*
100
)
...
...
Modules/_struct.c
View file @
75c3d6ff
...
...
@@ -1785,7 +1785,7 @@ s_pack_into(PyObject *self, PyObject *args)
assert
(
buffer_len
>=
0
);
/* Extract the offset from the first argument */
offset
=
Py
Long_AsSsize_t
(
PyTuple_GET_ITEM
(
args
,
1
)
);
offset
=
Py
Number_AsSsize_t
(
PyTuple_GET_ITEM
(
args
,
1
),
PyExc_IndexError
);
if
(
offset
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
...
...
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