summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-02-28 12:42:16 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-02-28 12:42:16 (GMT)
commit4b27e963e740c1676c258ee7ab9a4685bc6f7515 (patch)
tree6e14fdd1db7a7b24e6992461e8b29595957e904d /Lib/test
parente363fa020b1775879f16bac99e2eb5f1d42f8fd3 (diff)
downloadcpython-4b27e963e740c1676c258ee7ab9a4685bc6f7515.zip
cpython-4b27e963e740c1676c258ee7ab9a4685bc6f7515.tar.gz
cpython-4b27e963e740c1676c258ee7ab9a4685bc6f7515.tar.bz2
Merged revisions 70056 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70056 | hirokazu.yamamoto | 2009-02-28 21:13:07 +0900 | 2 lines Issue #1733986: Fixed mmap crash in accessing elements of second map object with same tagname but larger size than first map. (Windows) ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_mmap.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index c8e52a6..1ad611d 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -499,6 +499,34 @@ class MmapTests(unittest.TestCase):
m.seek(8)
self.assertRaises(ValueError, m.write, "bar")
+ if os.name == 'nt':
+ def test_tagname(self):
+ data1 = "0123456789"
+ data2 = "abcdefghij"
+ assert len(data1) == len(data2)
+ # Test same tag
+ m1 = mmap.mmap(-1, len(data1), tagname="foo")
+ m1[:] = data1
+ m2 = mmap.mmap(-1, len(data2), tagname="foo")
+ m2[:] = data2
+ self.assertEquals(m1[:], data2)
+ self.assertEquals(m2[:], data2)
+ # Test differnt tag
+ m1 = mmap.mmap(-1, len(data1), tagname="foo")
+ m1[:] = data1
+ m2 = mmap.mmap(-1, len(data2), tagname="boo")
+ m2[:] = data2
+ self.assertEquals(m1[:], data1)
+ self.assertEquals(m2[:], data2)
+
+ def test_tagname_crash(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
+
def test_main():
run_unittest(MmapTests)