1c4a6c3667
- add test for atexit module - add callback to gc collection - fix callback memory allocation - execute callback on both code and repl exit
23 lines
382 B
Python
23 lines
382 B
Python
# test atexit module
|
|
|
|
try:
|
|
import atexit
|
|
except ImportError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
@atexit.register
|
|
def skip_at_exit():
|
|
print("skip at exit")
|
|
|
|
|
|
@atexit.register
|
|
def do_at_exit(*args, **kwargs):
|
|
print("done at exit:", args, kwargs)
|
|
|
|
|
|
atexit.unregister(skip_at_exit)
|
|
atexit.register(do_at_exit, "ok", 1, arg="2", param=(3, 4))
|
|
print("done before exit")
|