4216bc7d13
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
22 lines
266 B
Python
22 lines
266 B
Python
# 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")
|