You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
263 B
18 lines
263 B
# test sys.atexit() function
|
|
|
|
import sys
|
|
try:
|
|
sys.atexit
|
|
except AttributeError:
|
|
print('SKIP')
|
|
raise SystemExit
|
|
|
|
some_var = None
|
|
|
|
def do_at_exit():
|
|
print("done at exit:", some_var)
|
|
|
|
sys.atexit(do_at_exit)
|
|
|
|
some_var = "ok"
|
|
print("done before exit")
|
|
|