diff options
author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2009-03-05 14:33:01 (GMT) |
---|---|---|
committer | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2009-03-05 14:33:01 (GMT) |
commit | 8e722bcf85641d0519f39c9ca31348c3b7a1d12e (patch) | |
tree | 2f0199db9959ff4be8565246d4d7c82cd75e3849 /Lib/test/test_mmap.py | |
parent | 9a8082f107d3fd3599c2f21a130413030e3d4cfe (diff) | |
download | cpython-8e722bcf85641d0519f39c9ca31348c3b7a1d12e.zip cpython-8e722bcf85641d0519f39c9ca31348c3b7a1d12e.tar.gz cpython-8e722bcf85641d0519f39c9ca31348c3b7a1d12e.tar.bz2 |
Merged revisions 70189 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70189 | hirokazu.yamamoto | 2009-03-05 23:21:12 +0900 | 4 lines
Issue #5385: Fixed mmap crash after resize failure on windows.
Now uses NULL instead of INVALID_HANDLE_VALUE as invalid map handle
because CreateFileMapping returns NULL when error occurs.
........
Diffstat (limited to 'Lib/test/test_mmap.py')
-rw-r--r-- | Lib/test/test_mmap.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 7398227..618d6c2 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -509,6 +509,7 @@ class MmapTests(unittest.TestCase): data1 = b"0123456789" data2 = b"abcdefghij" assert len(data1) == len(data2) + # Test same tag m1 = mmap.mmap(-1, len(data1), tagname="foo") m1[:] = data1 @@ -516,6 +517,9 @@ class MmapTests(unittest.TestCase): m2[:] = data2 self.assertEquals(m1[:], data2) self.assertEquals(m2[:], data2) + m2.close() + m1.close() + # Test differnt tag m1 = mmap.mmap(-1, len(data1), tagname="foo") m1[:] = data1 @@ -523,14 +527,42 @@ class MmapTests(unittest.TestCase): m2[:] = data2 self.assertEquals(m1[:], data1) self.assertEquals(m2[:], data2) + m2.close() + m1.close() - def test_tagname_crash(self): + def test_crasher_on_windows(self): # Should not crash (Issue 1733986) m = mmap.mmap(-1, 1000, tagname="foo") try: mmap.mmap(-1, 5000, tagname="foo")[:] # same tagname, but larger size except: pass + m.close() + + # Should not crash (Issue 5385) + m = mmap.mmap(-1, 1000) + try: + m.resize(0) + except: + pass + try: + m[:] + except: + pass + m.close() + + m1 = mmap.mmap(-1, 1000) + m2 = mmap.mmap(-1, 1000) + try: + m2.resize(5000) + except: + pass + try: + m2[:] + except: + pass + m2.close() + m1.close() def test_main(): |