[New-bugs-announce] [issue4335] inspect.getsourcelines ignores last line in module

Rafe Sacks report at bugs.python.org
Mon Nov 17 09:09:11 CET 2008


New submission from Rafe Sacks <rafesacks at gmail.com>:

Hi,

If the last line of the function is also the last line of the module, it
is ignored. To repro:

1) Create module 'repro'
<module>
def test():
    module_line_2 = None
    module_line_3 = None
    module_line_4 = None
    module_line_5 = None
<end module>

2) Run test:
>>> import repro
>>> import inspect
>>> inspect.getsourcelines(tmp.test)
(['def test():\n', '    module_line_2 = None\n', '    module_line_3 =
None\n', '    module_line_4 = None\n'], 1)

notice no module_line_5.


cheers,

- Rafe

----------
components: Library (Lib)
messages: 75953
nosy: RafeSacks
severity: normal
status: open
title: inspect.getsourcelines ignores last line in module
versions: Python 2.5

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


More information about the New-bugs-announce mailing list