Skip to content

Commit

Permalink
Workaround py2's lack of atexit.unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
njsmith committed Oct 17, 2022
1 parent 38b498a commit 1a82924
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions colorama/initialise.py
Expand Up @@ -21,8 +21,12 @@ def _wipe_internal_state_for_tests():
global fixed_windows_console
fixed_windows_console = False

# no-op if it wasn't registered
atexit.unregister(reset_all)
try:
# no-op if it wasn't registered
atexit.unregister(reset_all)
except AttributeError:
# python 2: no atexit.unregister. Oh well, we did our best.
pass


def reset_all():
Expand Down

0 comments on commit 1a82924

Please sign in to comment.