We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
inspect.getfile
1 parent 64906bb commit f0efff0Copy full SHA for f0efff0
1 file changed
Lib/inspect.py
@@ -265,7 +265,7 @@ def isgetsetdescriptor(object):
265
return False
266
267
def isfunction(object):
268
- """Return true if the object is a user-defined function.
+ """Return true if the object is a user-defined Python function.
269
270
Function objects provide these attributes:
271
__doc__ documentation string
@@ -828,9 +828,9 @@ def getfile(object):
828
if object.__module__ == '__main__':
829
raise OSError('source code not available')
830
raise TypeError('{!r} is a built-in class'.format(object))
831
- if ismethod(object):
+ if hasattr(object, '__func__'):
832
object = object.__func__
833
- if isfunction(object):
+ if hasattr(object, '__code__'):
834
object = object.__code__
835
if istraceback(object):
836
object = object.tb_frame
0 commit comments