From: Fred Drake Date: Fri, 18 Aug 2000 15:50:54 +0000 (+0000) Subject: Revise to use atexit instead of monkeying with sys.exitfunc directly. X-Git-Tag: v2.0b1~368 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b4fc17c6d6f6ee802ca909ee646eaedeee8e2ac;p=thirdparty%2FPython%2Fcpython.git Revise to use atexit instead of monkeying with sys.exitfunc directly. --- diff --git a/Lib/threading.py b/Lib/threading.py index fb2eb21778bf..4921f0e5c7bf 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -462,11 +462,8 @@ class _MainThread(Thread): _active_limbo_lock.acquire() _active[_get_ident()] = self _active_limbo_lock.release() - try: - self.__oldexitfunc = _sys.exitfunc - except AttributeError: - self.__oldexitfunc = None - _sys.exitfunc = self.__exitfunc + import atexit + atexit.register(self.__exitfunc) def _set_daemon(self): return 0 @@ -480,10 +477,6 @@ class _MainThread(Thread): while t: t.join() t = _pickSomeNonDaemonThread() - if self.__oldexitfunc: - if __debug__: - self._note("%s: calling exit handler", self) - self.__oldexitfunc() if __debug__: self._note("%s: exiting", self) self._Thread__delete()