From d072b5e8538a42b19de48f6cb348676fb05ff846 Mon Sep 17 00:00:00 2001 From: Sam Jhong <47290420+sam31046@users.noreply.github.com> Date: Sun, 27 Jul 2025 20:45:19 -0700 Subject: [PATCH] Fix #3809 IndexError: pop from empty list with Rich progress bar in 14.1.0 Fix #3809 IndexError: pop from empty list with Rich progress bar in 14.1.0 ## Type of changes * [x] Bug fix * [ ] New feature * [ ] Documentation / docstrings * [ ] Tests * [ ] Other ## Checklist * [ ] I've run the latest [black](https://github.com/psf/black) with default args on new code. * [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate. * [ ] I've added tests for new code. * [x] I accept that @willmcgugan may be pedantic in the code review. --- rich/console.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rich/console.py b/rich/console.py index 994adfc069..7cd4f0ad3b 100644 --- a/rich/console.py +++ b/rich/console.py @@ -844,7 +844,8 @@ def set_live(self, live: "Live") -> bool: def clear_live(self) -> None: """Clear the Live instance. Used by the Live context manager (no need to call directly).""" with self._lock: - self._live_stack.pop() + if self._live_stack: + self._live_stack.pop() def push_render_hook(self, hook: RenderHook) -> None: """Add a new render hook to the stack.