call close_handlers before garbage collection

avoids bug when this is called by `Application.__del__`
pull/1380/head
Min RK 2024-11-28 13:35:09 +01:00
rodzic 8a6eb6b19e
commit 4b33d0f395
Nie znaleziono w bazie danych klucza dla tego podpisu
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -482,6 +482,15 @@ def main():
if r2d.log_level == logging.DEBUG:
r2d.log.exception(e)
sys.exit(1)
finally:
# workaround bug in traitlets Application.__del__:
# https://github.com/ipython/traitlets/pull/912
# make sure close_handlers is called before process teardown
try:
r2d.close_handlers()
except AttributeError:
# traitlets < 5.10
pass
if __name__ == "__main__":