[Python-checkins] python/dist/src/Lib atexit.py,1.4,1.4.24.1

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 16 Jul 2002 13:09:09 -0700


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

Modified Files:
      Tag: release22-maint
	atexit.py 
Log Message:
The atexit module effectively turned itself off if sys.exitfunc already
existed at the time atexit first got imported.  That's a bug, and this
fixes it.

Also reworked test_atexit.py to test for this too, and to stop using
an "expected output" file, and to test what actually happens at exit
instead of just simulating what it thinks atexit will do at exit.


Index: atexit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v
retrieving revision 1.4
retrieving revision 1.4.24.1
diff -C2 -d -r1.4 -r1.4.24.1
*** atexit.py	21 Jan 2001 03:40:37 -0000	1.4
--- atexit.py	16 Jul 2002 20:09:07 -0000	1.4.24.1
***************
*** 30,42 ****
  
  import sys
! try:
!     x = sys.exitfunc
! except AttributeError:
!     sys.exitfunc = _run_exitfuncs
! else:
!     # if x isn't our own exit func executive, assume it's another
!     # registered exit function - append it to our list...
!     if x != _run_exitfuncs:
!         register(x)
  del sys
  
--- 30,38 ----
  
  import sys
! if hasattr(sys, "exitfunc"):
!     # Assume it's another registered exit function - append it to our list
!     register(sys.exitfunc)
! sys.exitfunc = _run_exitfuncs
! 
  del sys