diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e027e78f..913e82478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [9.8.2] - 2021-01-15 + +### Fixed + +- Fixed deadlock in live https://github.com/willmcgugan/rich/issues/927 + ## [9.8.1] - 2021-01-13 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 5dd452529..12fa57c64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "rich" homepage = "https://github.com/willmcgugan/rich" documentation = "https://rich.readthedocs.io/en/latest/" -version = "9.8.1" +version = "9.8.2" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" authors = ["Will McGugan "] license = "MIT" @@ -18,6 +18,7 @@ classifiers = [ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Typing :: Typed" ] include = ["rich/py.typed"] diff --git a/rich/live.py b/rich/live.py index 0c01a36e6..c3663a4ec 100644 --- a/rich/live.py +++ b/rich/live.py @@ -40,7 +40,8 @@ def stop(self) -> None: def run(self) -> None: while not self.done.wait(1 / self.refresh_per_second): with self.live._lock: - self.live.refresh() + if not self.done.is_set(): + self.live.refresh() class _LiveRender(LiveRender): @@ -157,8 +158,6 @@ def stop(self) -> None: try: if self.auto_refresh and self._refresh_thread is not None: self._refresh_thread.stop() - self._refresh_thread.join() - self._refresh_thread = None # allow it to fully render on the last even if overflow self.vertical_overflow = "visible" if not self.console.is_jupyter: @@ -179,6 +178,9 @@ def stop(self) -> None: # jupyter last refresh must occur after console pop render hook # i am not sure why this is needed self.refresh() + if self.auto_refresh and self._refresh_thread is not None: + self._refresh_thread.join() + self._refresh_thread = None def __enter__(self) -> "Live": self.start()