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 doerwalter
Recipients doerwalter
Date 2018-06-26.11:57:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When I call a function decorated with functools.singledispatch without an argument, I get the following:

$ python
Python 3.6.5 (default, Jun 17 2018, 12:13:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> @functools.singledispatch
... def f(x):
...     pass
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/", line 803, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
IndexError: tuple index out of range

I would have expected a TypeError along the lines of

TypeError: f() missing 1 required positional argument: 'x'
Date User Action Args
2018-06-26 11:57:10doerwaltersetrecipients: + doerwalter
2018-06-26 11:57:10doerwaltersetmessageid: <>
2018-06-26 11:57:10doerwalterlinkissue33967 messages
2018-06-26 11:57:10doerwaltercreate