Closed breathe closed 11 months ago
Good catch! Thanks for reporting!
I can reproduce with:
import signal
import sys
import time
import enlighten
# Create a counter and close it
manager = enlighten.get_manager()
with manager.counter(leave=False) as pbar:
pass
# Resize window and trigger signal
sys.stdout.write(f'\033[8;{manager.term.height - 2};{manager.term.width}t')
signal.raise_signal(signal.SIGWINCH)
# Wait for error
time.sleep(3)
I think it's an easy fix, but will need to come up with test code. I'll try to have a new release out soon.
Describe the bug When the manager still exists but the
enlighten.Counter()
's have all been.close(clear=True)
there's a crash that can happen inside resize handlerTo Reproduce
~I tried to extract a minimal repro but wasn't able to ... Logically the crash above happens where the
print("crash on resize possible from here in our codebase...")
message is printed ...~Found a way to repro -- code updated below
Failure output below
Observations
Environment (please complete the following information):
Additional context
~Sorry I tried to simulate what happens in our environment to repro ... What is above is my attempt to extract a repro ...~
Repro above works for me -- for additional context
The full stack trace within our application is actually within matplotlib if that provides any clues ...
(full stack trace minus our application code which calls into pandas plotting) ... Maybe the code in matplotlib is printing something?