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 <rep...@bugs.python.org>
<http://bugs.python.org/issue20075>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to