Serhiy Storchaka added the comment: > Yes, that is how it must work. This is symmetric with pure Python functions:
This is because in pure Python functions we have no enough information. I believe than origin expression is more useful in the help. Compare: >>> import re, inspect >>> p = re.compile('') >>> p.match.__text_signature__ '(string, pos=0, endpos=sys.maxsize)' >>> str(inspect.signature(p.match)) '(string, pos=0, endpos=2147483647)' > I suspect the problem is, you misspelled one of the expressions you provided > as a default value. >>> import zlib, inspect >>> zlib.decompress.__text_signature__ '(data, wbits=unspecified, bufsize=unspecified)' >>> str(inspect.signature(zlib.decompress)) Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 1997, in wrap_value value = eval(s, module_dict) File "<string>", line 1, in <module> NameError: name 'unspecified' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 2000, in wrap_value value = eval(s, sys_module_dict) File "<string>", line 1, in <module> NameError: name 'unspecified' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/serhiy/py/cpython/Lib/inspect.py", line 1468, in signature return Signature.from_builtin(obj) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2052, in from_builtin p(name, default) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2038, in p default_node = RewriteSymbolics().visit(default_node) File "/home/serhiy/py/cpython/Lib/ast.py", line 245, in visit return visitor(node) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2030, in visit_Name return wrap_value(node.id) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2002, in wrap_value raise RuntimeError() RuntimeError ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20293> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com