New submission from David Mc Dougall <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue46466>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com