mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +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
|
@ -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."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue