Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix syntax error when building with nuitka #2635

Merged
merged 3 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Reversed `pre` and `code` tags in base HTML format https://github.com/Textualize/rich/pull/2642
- Fix syntax error when building with nuitka https://github.com/Textualize/rich/pull/2635
- Fixed pretty printing of empty dataclass https://github.com/Textualize/rich/issues/2819

### Added
Expand Down
4 changes: 2 additions & 2 deletions rich/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def display_hook(value: Any) -> None:
)
builtins._ = value # type: ignore[attr-defined]

try: # pragma: no cover
if "get_ipython" in globals():
ip = get_ipython() # type: ignore[name-defined]
from IPython.core.formatters import BaseFormatter

Expand All @@ -272,7 +272,7 @@ def __call__(self, value: Any) -> Any:
# replace plain text formatter with rich formatter
rich_formatter = RichFormatter()
ip.display_formatter.formatters["text/plain"] = rich_formatter
except Exception:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I never used nuitka, I know enough to solute removal of "except Exception" ;)

else:
sys.displayhook = display_hook


Expand Down