atexit — Exit handlers — Python 3.16.0a0 documentation

docs.python.org

Tin mới

abc — Abstract Base Classes

traceback — Print or retrieve a stack traceback

Python Module Index

3.16.0a0 Documentation

The Python Standard Library

Python Runtime Services

interpreter shutdown

The atexit module defines functions to register and unregister exit handlers: functions that are automatically executed “at exit”, that is, upon normal program termination (for instance, if sys.exit() is called or the ma

concurrent.interpreters.Interpreter.close()

The atexit module defines functions to register and unregister exit handlers: functions that are automatically executed “at exit”, that is, upon normal program termination (for instance, if sys.exit() is called or the ma

Py_EndInterpreter()

The atexit module defines functions to register and unregister exit handlers: functions that are automatically executed “at exit”, that is, upon normal program termination (for instance, if sys.exit() is called or the ma

threading: Thread-based parallelism.

Changed in version 3.12: Attempts to start a new thread or os.fork() a new process in an exit handler now leads to RuntimeError. Previously, this could cause race conditions between the main Python runtime thread freeing

readline: GNU readline support for Python.

Useful example of atexit to read and write readline history files.