summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poll.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:26:26 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:26:26 (GMT)
commit441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (patch)
treea406cb41f1b78476445786f408b95b1cd0bdb7a6 /Lib/test/test_poll.py
parentff12fae80e15ad29ae2557d23e70f6ff9365b31f (diff)
downloadcpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.zip
cpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.tar.gz
cpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.tar.bz2
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
Diffstat (limited to 'Lib/test/test_poll.py')
-rw-r--r--Lib/test/test_poll.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index 7ab3b84..f2d1795 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -1,6 +1,7 @@
# Test case for the os.poll() function
import os, select, random, unittest
+import _testcapi
from test.support import TESTFN, run_unittest
try:
@@ -150,6 +151,15 @@ class PollTests(unittest.TestCase):
if x != 5:
self.fail('Overflow must have occurred')
+ pollster = select.poll()
+ # Issue 15989
+ self.assertRaises(OverflowError, pollster.register, 0,
+ _testcapi.SHRT_MAX + 1)
+ self.assertRaises(OverflowError, pollster.register, 0,
+ _testcapi.USHRT_MAX + 1)
+ self.assertRaises(OverflowError, pollster.poll, _testcapi.INT_MAX + 1)
+ self.assertRaises(OverflowError, pollster.poll, _testcapi.UINT_MAX + 1)
+
def test_main():
run_unittest(PollTests)