Defaulted positional-only hook parameters are forwarded as keywords
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start from the reproduction script in the issue: a hookimpl with a defaulted positional-only parameter, called as pm.hook.hello(value="caller"), currently raises a TypeError about positional-only arguments passed as keywords. Read how pluggy forwards hookimpl defaults and binds arguments for both old- and new-style wrappers, and check the explicit-value precedence described for #738. Done when the script prints ["caller"], a later optional positional-only argument leaves the earlier default intact, and the regression tests pass.
索引モデルが issue の本文から書いたものです。
説明
On current main 87f130aa18d8fdf9c92585e72423eca7f3de727d, the new hookimpl-default forwarding behavior passes defaulted positional-only arguments as keywords:
import pluggy
hookspec = pluggy.HookspecMarker("example")
hookimpl = pluggy.HookimplMarker("example")
class Spec:
@hookspec
def hello(self, value):
pass
class Plugin:
@hookimpl
def hello(self, value="fallback", /):
return value
pm = pluggy.PluginManager("example")
pm.add_hookspecs(Spec)
pm.register(Plugin())
print(pm.hook.hello(value="caller"))
Expected: ["caller"], following the explicit-value precedence introduced in #738. Actual: TypeError: ... got some positional-only arguments passed as keyword arguments: 'value'.
The same failure occurs in new- and old-style wrappers. Removing the default makes positional-only delivery work. If only a later optional positional-only argument is supplied, the earlier argument must retain its implementation default rather than shifting the supplied value.
Reproduced on native Windows and Linux CPython 3.12. The unmodified full suite passes 219 tests on both platforms; a focused added matrix has 13 failures and 9 passing controls on each. This concerns positional-only arguments, not the keyword-only API design in #742. I have a small fix and regression tests prepared.
AI assistance: OpenAI Codex; source inspection and native baseline/candidate tests were used to validate the finding.
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 187
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 23
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pytest-dev/pluggy のほかの issue
-
Plugin registry compares plugins by equality, not identity対応中かも @00200200 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
pytest-dev/pluggy#760 ·
メンテナーはふだん 1 日以内に返信
-
Pluggy 1.7.0 breaks scancode-toolkit対応中かも @adenzhou1350 が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
pytest-dev/pluggy#794 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Hook tracing crashes with specced Mock arguments and results対応中かも @Sandeep1519-droid が今日担当しました。 オープン
難易度 2/5 半日 初心者へのやさしさ 25/100
pytest-dev/pluggy#792 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
deprecate passing None as a plugin instance再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
pytest-dev/pluggy#790 ·
メンテナーはふだん 1 日以内に返信
-
list_plugin_distinfo() keeps unregistered plugins対応中かも @RonnyPfannschmidt が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
pytest-dev/pluggy#763 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
pytest-dev/pluggy の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
huggingface/sentence-transformers#4186 ·
メンテナーはふだん 5 日以内に返信
-
documentation good first issue
難易度 2/5 半日 初心者へのやさしさ 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
SCIInstitute/SCIRun#2842 ·
メンテナーはふだん 3 日以内に返信