mirror of https://github.com/Textualize/rich.git
Merge pull request #2037 from Textualize/repl-inspect-fix
Handle case inspect fails on repl-defined objects
This commit is contained in:
commit
b9b99ad770
|
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fixed Pretty measure not respecting expand_all https://github.com/Textualize/rich/issues/1998
|
||||
- Collapsed definitions for single-character spinners, to save memory and reduce import time.
|
||||
- Fix print_json indent type in __init__.py
|
||||
- Fix error when inspecting object defined in REPL https://github.com/Textualize/rich/pull/2037
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -98,7 +98,8 @@ class Inspect(JupyterMixin):
|
|||
source_filename: Optional[str] = None
|
||||
try:
|
||||
source_filename = getfile(obj)
|
||||
except TypeError:
|
||||
except (OSError, TypeError):
|
||||
# OSError is raised if obj has no source file, e.g. when defined in REPL.
|
||||
pass
|
||||
|
||||
callable_name = Text(name, style="inspect.callable")
|
||||
|
|
Loading…
Reference in New Issue