mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-30639: Lazily compute repr for error (#2132)
This commit is contained in:
parent
8e482bea21
commit
e968bc7357
3 changed files with 13 additions and 2 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue