A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-June/004749.html below:

standard way of defining and executing "atexit" functions...

[Python-Dev] Proposal: standard way of defining and executing "atexit" functions...Peter Funk pf@artcom-gmbh.de
Tue, 20 Jun 2000 10:08:16 +0200 (MEST)
Hi, 

I wrote:
> def register_exit_func(func, *args, **kw):
>     import sys
>     previous_func = sys.exit_func

this should have been 'sys.exitfunc'.
I've also misssed to note, that I placed the following line into 
the module init code: 

import sys; def _nop(): pass; sys.exitfunc = _nop
Otherwise I had to use getattr(sys, 'exitfunc', None) as David suggested.

Next time I should actually cut'n'paste working code instead typing from
blurred memory. :-(

Another point I forgot, was that you usually want to install signal
handlers on unices, that handle the signal.SIGTERM, signal.SIGHUP and
signal.SIGINT signals and invoke exit function to do some final
cleanup.

Regards, Peter



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4