[issue26729] Incorrect __text_signature__ for sorted
Erik Welch
report at bugs.python.org
Tue Apr 12 09:16:17 EDT 2016
Erik Welch added the comment:
sorted_3.patch corrects the __text_signature__. Behavior of sorted is unchanged.
>>> def raises(err, lamda):
... try:
... lamda()
... return False
... except err:
... return True
...
>>> import inspect
>>> sig = inspect.signature(sorted)
>>> # `iterable` is positional-only
>>> assert raises(TypeError, lambda: sorted(iterable=[]))
>>> assert raises(TypeError, lambda: sig.bind(iterable=[]))
>>> # `key` and `reverse` are keyword-only
>>> assert raises(TypeError, lambda: sorted([], lambda x: x))
>>> assert raises(TypeError, lambda: sig.bind([], lambda x: x))
----------
Added file: http://bugs.python.org/file42444/sorted_3.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26729>
_______________________________________
More information about the Python-bugs-list
mailing list