[docs] [issue12920] Inspect.getsource fails to get source of local classes

Popa Claudiu report at bugs.python.org
Tue Sep 6 20:37:58 CEST 2011


New submission from Popa Claudiu <pcmanticore at gmail.com>:

inspect.getsource called with a class defined in the same file fails with
TypeError: <module '__main__' (built-in)> is a built-in class, although the documentation says that:

"The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a single string." I think that should be specified in documentation that this function works only for objects living in a module.

----------
assignee: docs at python
components: Documentation
messages: 143645
nosy: Popa.Claudiu, docs at python
priority: normal
severity: normal
status: open
title: Inspect.getsource fails to get source of local classes
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12920>
_______________________________________


More information about the docs mailing list