[Python-checkins] python/dist/src/Lib/test test_mmap.py,1.27,1.28

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Tue, 10 Sep 2002 19:56:45 -0700


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

Modified Files:
	test_mmap.py 
Log Message:
test_both(): I believe this was a typo: m is only defined if no
exception occurred so it should only be closed in the else clause.
Without this change we can an UnboundLocalError on Linux:

Traceback (most recent call last):
  File "Lib/test/test_mmap.py", line 304, in ?
    test_both()
  File "Lib/test/test_mmap.py", line 208, in test_both
    m.close()
UnboundLocalError: local variable 'm' referenced before assignment


Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** test_mmap.py	10 Sep 2002 21:19:55 -0000	1.27
--- test_mmap.py	11 Sep 2002 02:56:42 -0000	1.28
***************
*** 206,210 ****
              if not sys.platform.startswith('win'):
                  verify(0, "Opening mmap with size+1 should raise ValueError.")
!         m.close()
          f.close()
          if sys.platform.startswith('win'):
--- 206,210 ----
              if not sys.platform.startswith('win'):
                  verify(0, "Opening mmap with size+1 should raise ValueError.")
!             m.close()
          f.close()
          if sys.platform.startswith('win'):