Author Claudiu.Popa
Recipients Claudiu.Popa, docs@python, eric.araujo
Date 2011-09-09.18:59:58
SpamBayes Score 4.21182e-09
Marked as misclassified No
Message-id <1315594799.24.0.20064280094.issue12920@psf.upfronthosting.co.za>
In-reply-to
Content
Yes. On Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32, the result for the following lines:

import inspect
class A:
    pass
inspect.getsource(A)

is:

Traceback (most recent call last):
  File "E:/Scripts/Snippets/test_inspect_bug.py", line 4, in <module>
    inspect.getsource(A)
  File "C:\Python32\lib\inspect.py", line 694, in getsource
    lines, lnum = getsourcelines(object)
  File "C:\Python32\lib\inspect.py", line 683, in getsourcelines
    lines, lnum = findsource(object)
  File "C:\Python32\lib\inspect.py", line 522, in findsource
    file = getsourcefile(object)
  File "C:\Python32\lib\inspect.py", line 441, in getsourcefile
    filename = getfile(object)
  File "C:\Python32\lib\inspect.py", line 406, in getfile
    raise TypeError('{!r} is a built-in class'.format(object))
TypeError: <module '__main__' (built-in)> is a built-in class
>>>
History
Date User Action Args
2011-09-09 18:59:59Claudiu.Popasetrecipients: + Claudiu.Popa, eric.araujo, docs@python
2011-09-09 18:59:59Claudiu.Popasetmessageid: <1315594799.24.0.20064280094.issue12920@psf.upfronthosting.co.za>
2011-09-09 18:59:58Claudiu.Popalinkissue12920 messages
2011-09-09 18:59:58Claudiu.Popacreate