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.

Author ggenellina
Recipients ggenellina
Date 2009-08-14.04:19:18
SpamBayes Score 5.91208e-11
Marked as misclassified No
Message-id <>
inspect.getsource(obj) returns incorrect results when obj is a 
traceback or frame object outside any function (that is, at the module 

This demo script shows the problem. The correct output should contain 
all source lines in the module, but it only returns the first two:

def foo(x):
  return y + z

import inspect
frame = inspect.currentframe()
print inspect.getsource(frame)

def foo(x):
  return y + z

The attached patch fixes the problem and adds some missing test cases.
Originally reported by Juanjo Conti at the local Python group.
Date User Action Args
2009-08-14 04:19:22ggenellinasetrecipients: + ggenellina
2009-08-14 04:19:22ggenellinasetmessageid: <>
2009-08-14 04:19:21ggenellinalinkissue6700 messages
2009-08-14 04:19:20ggenellinacreate