homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: inspect.getsource is failing for sys.excepthook
Type: Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, chillaranand
Priority: normal Keywords:

Created on 2015年04月19日 18:53 by chillaranand, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
trace4.py chillaranand, 2015年04月19日 18:53
Messages (2)
msg241537 - (view) Author: Anand Reddy Pandikunta (chillaranand) * Date: 2015年04月19日 18:53
>>> inspect.getsource(sys.excepthook)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/local/lib/python2.7/inspect.py", line 701, in getsource
 lines, lnum = getsourcelines(object)
 File "/usr/local/lib/python2.7/inspect.py", line 690, in getsourcelines
 lines, lnum = findsource(object)
 File "/usr/local/lib/python2.7/inspect.py", line 526, in findsource
 file = getfile(object)
 File "/usr/local/lib/python2.7/inspect.py", line 420, in getfile
 'function, traceback, frame, or code object'.format(object))
TypeError: <built-in function excepthook> is not a module, class, method, function, traceback, frame, or code object
msg241548 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2015年04月19日 19:17
That's actually expected, since sys.excepthook is a builtin, so there's no source code to be retrieved (the same holds for other builtins, such as next, range etc).
History
Date User Action Args
2022年04月11日 14:58:15adminsetgithub: 68196
2015年04月19日 19:17:00Claudiu.Popasetstatus: open -> closed

nosy: + Claudiu.Popa
messages: + msg241548

resolution: not a bug
stage: resolved
2015年04月19日 18:53:57chillaranandcreate

AltStyle によって変換されたページ (->オリジナル) /