mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
commit
9101e23ff6
19 changed files with 151 additions and 25 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue