summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2006-05-26 13:15:44 (GMT)
committerBob Ippolito <bob@redivi.com>2006-05-26 13:15:44 (GMT)
commite27337b5d01a63f6874382175221936780e50acd (patch)
tree16c35c85867b748119af195008be037faca78519 /Lib/test
parent669fa188b13cccf0cff53d570d0d5371948bac11 (diff)
downloadcpython-e27337b5d01a63f6874382175221936780e50acd.zip
cpython-e27337b5d01a63f6874382175221936780e50acd.tar.gz
cpython-e27337b5d01a63f6874382175221936780e50acd.tar.bz2
fix #1229380 No struct.pack exception for some out of range integers
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_struct.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 59cace2..26db4ca 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -10,6 +10,8 @@ del sys
verify((struct.pack('=i', 1)[0] == chr(0)) == ISBIGENDIAN,
"bigendian determination appears wrong")
+PY_STRUCT_RANGE_CHECKING = 1
+
def string_reverse(s):
chars = list(s)
chars.reverse()
@@ -266,7 +268,7 @@ class IntTester:
else:
# x is out of range -- verify pack realizes that.
- if code in self.BUGGY_RANGE_CHECK:
+ if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK:
if verbose:
print "Skipping buggy range check for code", code
else:
@@ -442,6 +444,7 @@ def test_705836():
test_705836()
def test_1229380():
+ import sys
for endian in ('', '>', '<'):
for cls in (int, long):
for fmt in ('B', 'H', 'I', 'L'):
@@ -453,8 +456,7 @@ def test_1229380():
any_err(struct.pack, endian + 'I', sys.maxint * 4L)
any_err(struct.pack, endian + 'L', sys.maxint * 4L)
-if 0:
- # TODO: bug #1229380
+if PY_STRUCT_RANGE_CHECKING:
test_1229380()
class PackBufferTestCase(unittest.TestCase):