New submission from Xiang Zhang:
In #29649, struct.pack_into's error message was improved. But the message could
be confusing encountering a large offset due to overflow:
>>> struct.pack_into('I', bytearray(10), sys.maxsize, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: pack_into requires a buffer of at least -9223372036854775805
bytes for packing 4 bytes at offset 9223372036854775807 (actual buffer size is
10)
BTW, really long the error message.
----------
messages: 292852
nosy: andrewnester, louielu, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: needs patch
status: open
title: possible overflow when organize struct.pack_into error message
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30245>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com