diff options
author | Thomas Kluyver <takowl@gmail.com> | 2017-10-24 12:42:36 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2017-10-24 12:42:36 (GMT) |
commit | e968bc735794a7123f28f26d68fdf5dc8c845280 (patch) | |
tree | be1afebab108ab43fec3d577fe4be021278f7801 /Lib/test | |
parent | 8e482bea21cb942804234e36d3c6c896aabd32da (diff) | |
download | cpython-e968bc735794a7123f28f26d68fdf5dc8c845280.zip cpython-e968bc735794a7123f28f26d68fdf5dc8c845280.tar.gz cpython-e968bc735794a7123f28f26d68fdf5dc8c845280.tar.bz2 |
bpo-30639: Lazily compute repr for error (#2132)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_inspect.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 819fcc5..e64215d 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -463,6 +463,14 @@ class TestRetrievingSourceCode(GetSourceBase): with self.assertRaises(TypeError): inspect.getfile(C) + def test_getfile_broken_repr(self): + class ErrorRepr: + def __repr__(self): + raise Exception('xyz') + er = ErrorRepr() + with self.assertRaises(TypeError): + inspect.getfile(er) + def test_getmodule_recursion(self): from types import ModuleType name = '__inspect_dummy' |