This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients berker.peksag, larry, serhiy.storchaka
Date 2014-01-22.13:26:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <3941338.dHdhqzGdmB@raxxla>
In-reply-to <1390396401.05.0.850423754007.issue20293@psf.upfronthosting.co.za>
Content
> 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
History
Date User Action Args
2014-01-22 13:26:03serhiy.storchakasetrecipients: + serhiy.storchaka, larry, berker.peksag
2014-01-22 13:26:03serhiy.storchakalinkissue20293 messages
2014-01-22 13:26:02serhiy.storchakacreate