Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue 30245
  • Loading branch information
johanliu committed May 20, 2017
commit 890b93eebb2ec7034914512dda40959f8348e7c7
6 changes: 3 additions & 3 deletions Lib/test/test_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ def test_pack_into(self):

# Test overflows cause by large offset and value size (issue 30245)
regex = (
r'pack_into requires a buffer of at least 9223372036854775811 '
r'bytes for packing 4 bytes at offset 9223372036854775807 '
r'\(actual buffer size is 10\)'
"pack_into requires a buffer of at least " + str(sys.maxsize + 4) +
" bytes for packing 4 bytes at offset " + str(sys.maxsize) +
" (actual buffer size is 10)"
)

with self.assertRaisesRegex(struct.error, regex):
Expand Down
2 changes: 1 addition & 1 deletion Modules/_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
assert(soself->s_size >= 0);

PyErr_Format(StructError,
"pack_into requires a buffer of at least %zd bytes for "
"pack_into requires a buffer of at least %zu bytes for "
"packing %zd bytes at offset %zd "
"(actual buffer size is %zd)",
(size_t)soself->s_size + (size_t)offset,
Expand Down