[New-bugs-announce] [issue46466] help function reads comments
David Mc Dougall
report at bugs.python.org
Fri Jan 21 20:38:03 EST 2022
New submission from David Mc Dougall <dam1784 at g.rit.edu>:
My inline comment ('#') got picked up by the help command.
Write the following code to a file (I named it "reproducer.py"):
"""
class Foo:
# Hello docstring, I'm a '#' comment!
def bar(self):
pass
assert Foo.bar.__doc__ is None
help(Foo.bar)
"""
The bug only happens when the file is executed.
$ python3 reproducer.py
Help on function bar in module __main__:
bar(self)
# Hello docstring, I'm a '#' comment!
Evaluating it at the interactive prompt does not reproduce the bug.
$ cat reproducer.py | python3
Help on function bar in module __main__:
bar(self)
----------
messages: 411218
nosy: dam1784
priority: normal
severity: normal
status: open
title: help function reads comments
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46466>
_______________________________________
More information about the New-bugs-announce
mailing list