Commit 4dfe87a0 authored by Tres Seaver's avatar Tres Seaver

struct.pack raises OverflowError in PyPy.

parent 43a1d613
......@@ -1135,7 +1135,9 @@ def to_int(self, v):
try:
if not unpack("i", pack("i", v))[0] == v:
raise TypeError('32-bit integer expected')
except struct.error:
except (struct.error,
OverflowError, #PyPy
):
raise TypeError('32-bit integer expected')
return int(v)
......@@ -1153,7 +1155,9 @@ def to_long(self, v):
if isinstance(v, int_types):
raise ValueError("Value out of range", v)
raise TypeError('64-bit integer expected')
except struct.error:
except (struct.error,
OverflowError, #PyPy
):
if isinstance(v, int_types):
raise ValueError("Value out of range", v)
raise TypeError('64-bit integer expected')
......
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