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: getsource and getsourcelines in the inspect module
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jlgijsbers, sonderblade
Priority: normal Keywords:

Created on 2005-01-07 20:28 by sonderblade, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg23886 - (view) Author: Björn Lindqvist (sonderblade) Date: 2005-01-07 20:28
import inspect

class Hi:
    def oneliner1(): pass
    def oneliner2(): pass

h = Hi()
print inspect.getsourcelines(h.oneliner1)
print "+++" + inspect.getsource(h.oneliner1) + "+++"

Tested on Python 2.3.4. Both the getsource* functions
takes the body of onliner1() and oneliner2() in the call.
msg23887 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2005-01-08 11:09
Logged In: YES 
user_id=469548

This is fixed in Python 2.5 and the upcoming 2.4.1 by patch
1011890. Thanks for the report, though. 
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41409
2005-01-07 20:28:46sonderbladecreate