call_extra() drops arguments for partial callbacks
维护者通常 1 天内回复
评估
调研方向
Start with the reproducer in the issue, which uses HookCaller.call_extra() with a functools.partial callback. The problem is in varnames(), which reads the partial's own __call__ instead of its remaining signature, so the bound arguments are never forwarded. Run the snippet and confirm it returns [("demo", 7)], then check the existing varnames() tests for plain functions and partials.
由索引模型根据 Issue 内容生成。
描述
Passing a functools.partial callback to HookCaller.call_extra() drops the remaining hook arguments. A callback with a required argument raises TypeError; one with a default silently uses that default instead of the supplied value.
from functools import partial
import pluggy
hookspec = pluggy.HookspecMarker("example")
class Hooks:
@hookspec
def event(self, value):
pass
def on_event(context, value):
return context, value
pm = pluggy.PluginManager("example")
pm.add_hookspecs(Hooks)
callback = partial(on_event, "demo")
assert callback(7) == ("demo", 7)
print(pm.hook.event.call_extra([callback], {"value": 7}))
Expected: [("demo", 7)].
Actual: TypeError: on_event() missing 1 required positional argument: 'value'.
varnames() inspects the partial's built-in __call__ rather than its remaining signature, so no parameters are forwarded.
Reproduced on Python 3.12.16/Linux with main 3fc9e561ea7e72a95549673d79ebdaf4a9fae829.
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 200
- 平均合并
- 10 小时 4 分钟
- 30 天内合并 PR
- 13
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytest-dev/pluggy 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 71/100
pytest-dev/pluggy#830 ·
维护者通常 1 天内回复
-
Plugin registry compares plugins by equality, not identity可能已有人在做 @00200200 于 30 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
pytest-dev/pluggy#760 ·
维护者通常 1 天内回复
-
add_hookcall_monitoring undo breaks when called out of LIFO order可能已有人在做 @AlvaroBalbin 于 7 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
pytest-dev/pluggy#815 ·
维护者通常 1 天内回复
-
call_historic() memorizes the caller's kwargs mapping, so later mutation changes what late plugins receive可能已有人在做 @RonnyPfannschmidt 于 21 天前认领。 未关闭
pytest-dev/pluggy#808 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
deprecate passing None as a plugin instance可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 30/100
pytest-dev/pluggy#790 · 1 条评论 ·
维护者通常 1 天内回复
查看 pytest-dev/pluggy 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
NVIDIA/nsight-python#88 ·
维护者通常 1 天内回复
-
Criteria can pass when the deliverable is missing可能已有人在做 @clementtisseau 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
harveyai/harvey-labs#217 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
难度 2/5 1-3 小时 新手友好度 83/100
databrickslabs/ontos#1420 ·
维护者通常 3 天内回复