Skip to content

Commit

Permalink
call close_handlers before garbage collection
Browse files Browse the repository at this point in the history
avoids bug when this is called by `Application.__del__`
  • Loading branch information
minrk committed Nov 28, 2024
1 parent 8a6eb6b commit 4b33d0f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions repo2docker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down

0 comments on commit 4b33d0f

Please sign in to comment.