[Python-checkins] python/dist/src/Lib atexit.py,1.8,1.8.2.1
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sat Dec 11 03:53:29 CET 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16868/Lib
Modified Files:
Tag: release24-maint
atexit.py
Log Message:
SF bug #1083202: UnboundLocalError raised by atexit module
The sys module could be called before being imported.
Index: atexit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -d -r1.8 -r1.8.2.1
--- atexit.py 4 Nov 2004 04:31:30 -0000 1.8
+++ atexit.py 11 Dec 2004 02:53:27 -0000 1.8.2.1
@@ -7,6 +7,8 @@
__all__ = ["register"]
+import sys
+
_exithandlers = []
def _run_exitfuncs():
"""run any registered exit functions
@@ -23,7 +25,7 @@
except SystemExit:
exc_info = sys.exc_info()
except:
- import sys, traceback
+ import traceback
print >> sys.stderr, "Error in atexit._run_exitfuncs:"
traceback.print_exc()
exc_info = sys.exc_info()
@@ -41,12 +43,10 @@
"""
_exithandlers.append((func, targs, kargs))
-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
if __name__ == "__main__":
def x1():
More information about the Python-checkins
mailing list