diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:26:26 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:26:26 (GMT) |
commit | 441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (patch) | |
tree | a406cb41f1b78476445786f408b95b1cd0bdb7a6 /Lib/test/test_fileio.py | |
parent | ff12fae80e15ad29ae2557d23e70f6ff9365b31f (diff) | |
download | cpython-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_fileio.py')
-rw-r--r-- | Lib/test/test_fileio.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index b5bd8d4..8267d9e 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -7,6 +7,7 @@ import unittest from array import array from weakref import proxy from functools import wraps +import _testcapi from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd from collections import UserList @@ -346,6 +347,9 @@ class OtherFileTests(unittest.TestCase): if sys.platform == 'win32': import msvcrt self.assertRaises(IOError, msvcrt.get_osfhandle, make_bad_fd()) + # Issue 15989 + self.assertRaises(TypeError, _FileIO, _testcapi.INT_MAX + 1) + self.assertRaises(TypeError, _FileIO, _testcapi.INT_MIN - 1) def testBadModeArgument(self): # verify that we get a sensible error message for bad mode argument |