diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 618d6c2cafc..7e0599a8819 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -540,9 +540,12 @@ class MmapTests(unittest.TestCase): m.close() # Should not crash (Issue 5385) - m = mmap.mmap(-1, 1000) + open(TESTFN, "wb").write(b"x"*10) + f = open(TESTFN, "r+b") + m = mmap.mmap(f.fileno(), 0) + f.close() try: - m.resize(0) + m.resize(0) # will raise WindowsError except: pass try: @@ -551,19 +554,6 @@ class MmapTests(unittest.TestCase): 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(): run_unittest(MmapTests)