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:
Serhiy Storchaka 2013-01-19 12:41:45 +02:00
commit 9101e23ff6
19 changed files with 151 additions and 25 deletions

View file

@ -17,6 +17,7 @@ import stat
import tempfile
import unittest
import warnings
import _testcapi
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
support.TESTFN + '-dummy-symlink')
@ -537,6 +538,10 @@ class PosixTester(unittest.TestCase):
except OSError:
pass
# Issue 15989
self.assertRaises(OverflowError, os.pipe2, _testcapi.INT_MAX + 1)
self.assertRaises(OverflowError, os.pipe2, _testcapi.UINT_MAX + 1)
def test_utime(self):
if hasattr(posix, 'utime'):
now = time.time()