Skip to content

Commit 4b33d0f

Browse files
committed
call close_handlers before garbage collection
avoids bug when this is called by `Application.__del__`
1 parent 8a6eb6b commit 4b33d0f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

repo2docker/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,15 @@ def main():
482482
if r2d.log_level == logging.DEBUG:
483483
r2d.log.exception(e)
484484
sys.exit(1)
485+
finally:
486+
# workaround bug in traitlets Application.__del__:
487+
# https://github.com/ipython/traitlets/pull/912
488+
# make sure close_handlers is called before process teardown
489+
try:
490+
r2d.close_handlers()
491+
except AttributeError:
492+
# traitlets < 5.10
493+
pass
485494

486495

487496
if __name__ == "__main__":

0 commit comments

Comments
 (0)