bpo-29649: struct.pack_into check boundary error message didn't respect offset by andrewnester · Pull Request #424 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewnester’s current proposals are

1: pack_into requires a buffer of at least R bytes for packing P bytes at offset O (actual buffer size is B)
2: pack_into requires negative offset not higher than H (actual offset is O)
3: pack_into requires negative offset not lower than L (actual offset is O)

I agree the negative offset ones are awkward. My suggestions:

2: No space to pack 11 bytes at offset −10
3: Offset −11 out of range for 10-byte buffer