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/inspect.py | |
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/inspect.py')
-rw-r--r-- | Lib/inspect.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 9a843d6..6d6fde9 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -662,8 +662,9 @@ def getfile(object): object = object.f_code if iscode(object): return object.co_filename - raise TypeError('{!r} is not a module, class, method, ' - 'function, traceback, frame, or code object'.format(object)) + raise TypeError('module, class, method, function, traceback, frame, or ' + 'code object was expected, got {}'.format( + type(object).__name__)) def getmodulename(path): """Return the module name for a given file, or None.""" |