[Python-Dev] Deprecate sys.exitfunc? (original) (raw)
Raymond Hettinger raymond.hettinger at verizon.net
Sun Aug 15 23:41:26 CEST 2004
- Previous message: [Python-Dev] Decorators are function/method subclassing technique?
- Next message: [Python-Dev] Deprecate sys.exitfunc?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The documentation for the atexit module (introduced in Py2.0) states:
"""Note: This module is unlikely to work correctly when used with other code that sets sys.exitfunc. In particular, other core Python modules are free to use atexit without the programmer's knowledge. Authors who use sys.exitfunc should convert their code to use atexit instead. The simplest way to convert code that sets sys.exitfunc is to import atexit and register the function that had been bound to sys.exitfunc."""
Can we strengthen this by deprecating sys.exitfunc?
The atexit module does attempt to co-exist by introducing code to register a function in sys.exitfunc if it were defined before "import atexit" was called. However, this is unreliable because it depends on import order and the library is free to introduce an earlier "import atexit" which would break code relying on the co-existance mechanism.
Raymond
- Previous message: [Python-Dev] Decorators are function/method subclassing technique?
- Next message: [Python-Dev] Deprecate sys.exitfunc?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]