Skip to content

Commit 17fa868

Browse files
committed
hooks: inline __call__() into call_extra()
Preparation for next commit.
1 parent e77787b commit 17fa868

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pluggy/_hooks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ def call_extra(
403403
) -> Any:
404404
"""Call the hook with some additional temporarily participating
405405
methods using the specified ``kwargs`` as call parameters."""
406+
assert (
407+
not self.is_historic()
408+
), "Cannot directly call a historic hook - use call_historic instead."
409+
self._verify_all_args_are_provided(kwargs)
406410
old = list(self._nonwrappers), list(self._wrappers)
407411
for method in methods:
408412
opts: "_HookImplOpts" = {
@@ -414,8 +418,9 @@ def call_extra(
414418
}
415419
hookimpl = HookImpl(None, "<temp>", method, opts)
416420
self._add_hookimpl(hookimpl)
421+
firstresult = self.spec.opts.get("firstresult", False) if self.spec else False
417422
try:
418-
return self(**kwargs)
423+
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
419424
finally:
420425
self._nonwrappers, self._wrappers = old
421426

0 commit comments

Comments
 (0)