[issue20075] help(open) eats first line

Gennadiy Zlobin report at bugs.python.org
Fri Dec 27 15:12:39 CET 2013


Gennadiy Zlobin added the comment:

Yes, so basically signature line in help(open) is not shown because ast.parse fails to parse the return value

-> file object

According to grammar, it should be 
-> file 
or 
-> 'file object' 
or something like this.

as for sqlite, it fails to parse square brackets:

connect(database[, timeout, detect_types, isolation_level,\n\
        check_same_thread, factory, cached_statements, uri])

As an idea, maybe we can come up with a failover i.e. if ast can't parse the signature, just use __text_signature__ instead of signature object:

Lib/pydoc.py:1325
if not argspec:
-   argspec = '(...)'
+   argspec = object.__text_signature__


Or probably just don't show the signature if it is not formatted correctly as it is now (after the patch applied).

----------

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


More information about the Python-bugs-list mailing list