[Python-checkins] python/dist/src/Lib/test test_mmap.py,1.19.8.5,1.19.8.6

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Fri, 10 Jan 2003 13:02:48 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv25944/Lib/test

Modified Files:
      Tag: release22-maint
	test_mmap.py 
Log Message:
backport:
SF #665913, Fix mmap module core dump with unix

Closing an mmap'ed file (calling munmap) twice on Solaris caused a core dump.


Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.19.8.5
retrieving revision 1.19.8.6
diff -C2 -d -r1.19.8.5 -r1.19.8.6
*** test_mmap.py	24 Sep 2002 16:21:36 -0000	1.19.8.5
--- test_mmap.py	10 Jan 2003 21:02:41 -0000	1.19.8.6
***************
*** 298,301 ****
--- 298,319 ----
              pass
  
+     # make sure a double close doesn't crash on Solaris (Bug# 665913)
+     f = open(TESTFN, 'w+')
+ 
+     try:    # unlink TESTFN no matter what
+         f.write(2**24 * 'a') # Arbitrary character
+         f.close()
+ 
+         f = open(TESTFN)
+         mf = mmap.mmap(f.fileno(), 2**24, access=mmap.ACCESS_READ)
+         mf.close()
+         mf.close()
+         f.close()
+ 
+     finally:
+         try:
+             os.unlink(TESTFN)
+         except OSError:
+             pass