[issue23217] help() function incorrectly captures comment preceding a nested function

2021-11-29 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11. -- nosy: +iritkatriel versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.2, Python 3.3, Python 3.5 ___ Python tracker _

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-04-15 Thread Raúl Cumplido
Raúl Cumplido added the comment: I am not sure what the expected behavior is. Based on the code on pydoc.py we can find: def getdoc(object): """Get the doc string or comments for an object.""" result = inspect.getdoc(object) or inspect.getcomments(object) So if the doc string is not fou

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-19 Thread anupama srinivas murthy
anupama srinivas murthy added the comment: In Python 2.7, the capture happens even if there is no decorator. The code: #Hey this is f def f(): return help(f) gives the output: Help on function f in module __main__: f() #Hey this is f whereas a docstring inside the function causes the com

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-18 Thread Gwenlliana
Gwenlliana added the comment: Though standard library contains a workaround on the decorator issue (functools.wraps), but it still failed to patch func_code.co_firstlineno, which led the pydoc module to capture the wrong comment. -- ___ Python track

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-18 Thread Gwenlliana
Gwenlliana added the comment: The capture actually worked correctly. It seems to be caused by the artifacts introduced by the evaluation function decorators. Decorator lists for functions are compiled to a series of high-order function applications to the original function, followed by an assi

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-18 Thread anupama srinivas murthy
anupama srinivas murthy added the comment: The comment is captured only in the absence of a docstring within the function. The capture happens whether the function is nested or otherwise -- nosy: +anupama.srinivas.murthy ___ Python tracker

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-10 Thread R. David Murray
Changes by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue23217] help() function incorrectly captures comment preceding a nested function

2015-01-10 Thread Raymond Hettinger
New submission from Raymond Hettinger: The help() function mysteriously captures a comment on the line preceding an inner function definition in a nested scope. Given this code: def outer(func): #comment def inner(): return return inner