Read about our upcoming Code of Conduct on this issue

Commit 8d117be8 authored by Bernd Schoeller's avatar Bernd Schoeller
Browse files

Checking for overflow in ctypes array creation (fixing test.test_ctypes)

branch : py3.7
parent dc491b783ef7
......@@ -275,6 +275,8 @@ def create_array_type(base, length):
raise TypeError("Can't multiply a ctypes type by a non-integer")
if length < 0:
raise ValueError("Array length must be >= 0")
if length * base._sizeofinstances() > sys.maxsize:
raise OverflowError("array too large")
key = (base, length)
return ARRAY_CACHE[key]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment