mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-21 07:35:08 +00:00
Fix PNG dimension validation test on 32-bit platforms
Expect OverflowError for dimensions that exceed sys.maxsize, since PyArg_ParseTuple rejects them before the PNG buffer validation runs. Continue to expect ValueError for invalid dimensions and buffer lengths that reach the validation code.
This commit is contained in:
parent
0b1b477409
commit
51b159f990
1 changed files with 4 additions and 1 deletions
|
|
@ -116,7 +116,10 @@ class TestDataTypes(BaseTest):
|
|||
(rgba, 2**32 + 2, 2),
|
||||
(rgba, -2, -2),
|
||||
):
|
||||
with self.assertRaises(ValueError, msg=repr(args[1:])):
|
||||
# Dimensions outside Py_ssize_t fail during argument parsing, before
|
||||
# the buffer length and dimension validation can raise ValueError.
|
||||
error = OverflowError if any(x > sys.maxsize for x in args[1:]) else ValueError
|
||||
with self.assertRaises(error, msg=repr(args[1:])):
|
||||
png_from_32bit_rgba_data(*args)
|
||||
with self.assertRaises(OverflowError):
|
||||
png_from_32bit_rgba_data(rgba, 2, 2**64 + 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue