diff options
| author | Brian Curtin <brian.curtin@gmail.com> | 2010-08-01 15:47:53 (GMT) |
|---|---|---|
| committer | Brian Curtin <brian.curtin@gmail.com> | 2010-08-01 15:47:53 (GMT) |
| commit | ba6c08e67077a368c21016171446c26eef5c27d2 (patch) | |
| tree | 546a2c82f1d1f9063306adae0a8e09211ea01480 /Lib/test/test_mmap.py | |
| parent | aad57bd1bbaea92a5619a8d79d3d2ed90d32a35f (diff) | |
| download | cpython-ba6c08e67077a368c21016171446c26eef5c27d2.zip cpython-ba6c08e67077a368c21016171446c26eef5c27d2.tar.gz cpython-ba6c08e67077a368c21016171446c26eef5c27d2.tar.bz2 | |
Merged revisions 83407 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83407 | brian.curtin | 2010-08-01 10:26:26 -0500 (Sun, 01 Aug 2010) | 3 lines
Fix #8105. Add validation to mmap.mmap so invalid file descriptors
don't cause a crash on Windows.
........
Diffstat (limited to 'Lib/test/test_mmap.py')
| -rw-r--r-- | Lib/test/test_mmap.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 14dd278..a3998e2 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -1,6 +1,6 @@ from test.test_support import TESTFN, run_unittest, import_module import unittest -import os, re, itertools +import os, re, itertools, socket mmap = import_module('mmap') @@ -586,6 +586,16 @@ class MmapTests(unittest.TestCase): pass m.close() + def test_invalid_descriptor(self): + # socket file descriptors are valid, but out of range + # for _get_osfhandle, causing a crash when validating the + # parameters to _get_osfhandle. + s = socket.socket() + try: + with self.assertRaises(mmap.error): + m = mmap.mmap(s.fileno(), 10) + finally: + s.close() def test_main(): run_unittest(MmapTests) |
