[New-bugs-announce] [issue29649] struct.pack_into check boundary error message didn't respect offset

Louie Lu report at bugs.python.org
Sat Feb 25 08:53:04 EST 2017


New submission from Louie Lu:

For this situation, check boundary error message didn't correctly show out.

>>> import struct
>>> import ctypes
>>> byte_list = ctypes.create_string_buffer(1)
>>> struct.pack_into('b', byte_list, 5, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: pack_into requires a buffer of at least 1 bytes

Since offset is setting at 5, it should at least need `offset + soself->s_size` bytes to store it.

----------
components: Extension Modules
messages: 288564
nosy: louielu
priority: normal
severity: normal
status: open
title: struct.pack_into check boundary error message didn't respect offset
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29649>
_______________________________________


More information about the New-bugs-announce mailing list