diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:41:45 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:41:45 (GMT) |
commit | 9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3 (patch) | |
tree | c61aebdba4dddc8f10c9460ca33b0fa3f2e1495d /Lib/test/test_fileio.py | |
parent | bd8f29028eab752e8e5c73703218a701028c1a9a (diff) | |
parent | 441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (diff) | |
download | cpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.zip cpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.tar.gz cpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.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 0847961..19737d9 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -8,6 +8,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 @@ -347,6 +348,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 |