Skip to content

Commit e2fa34b

Browse files
author
Tyler Goodlet
committed
Raise explicit error when impl called with pos args
Raise an explicit TypeError to alert the user that they are calling a hookimpl incorrectly with positional args; keyword args are allowed only. Fixes #53
1 parent 6689c91 commit e2fa34b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pluggy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,9 @@ def _add_hookimpl(self, hookimpl):
664664
def __repr__(self):
665665
return "<_HookCaller %r>" % (self.name,)
666666

667-
def __call__(self, **kwargs):
667+
def __call__(self, *args, **kwargs):
668+
if args:
669+
raise TypeError("hook calling supports only keyword arguments")
668670
assert not self.is_historic()
669671
if self.argnames:
670672
notincall = set(self.argnames) - set(['__multicall__']) - set(

0 commit comments

Comments
 (0)