Defaulted positional-only hook parameters are forwarded as keywords
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 1.7k
- Forks
- 172
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 21
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytest-dev/pluggy
-
Plugin registry compares plugins by equality, not identityPosiblemente ocupada @00200200 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
pytest-dev/pluggy#760 ·
Los mantenedores suelen responder en 1 día
-
list_plugin_distinfo() keeps unregistered pluginsPosiblemente ocupada @RonnyPfannschmidt la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
pytest-dev/pluggy#763 ·
Los mantenedores suelen responder en 1 día
-
unregister() argument validation relies on assertPosiblemente ocupada @ekanshul la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 42/100
pytest-dev/pluggy#762 ·
Los mantenedores suelen responder en 1 día
-
Failures during add_hookspecs / historic replay leave partial statePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
pytest-dev/pluggy#761 ·
Los mantenedores suelen responder en 1 día
-
[Downstream] devpi broken - trying to register `None`Posiblemente ocupada @bluetech la tomó hace 13 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
pytest-dev/pluggy#749 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de pytest-dev/pluggy
Issues similares
-
effort: low prio: low ready
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
digitalfabrik/integreat-cms#4616 ·
Los mantenedores suelen responder en 5 días
-
bug difficulty:2 good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
MakazhanAlpamys/Soup#1865 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FinanceFlash/unvibecode#233 ·
Los mantenedores suelen responder en 1 día
-
area: agents area: docs good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exemptPosiblemente ocupada @adityasinha-ghub la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
pylint-dev/pylint#11656 ·
Los mantenedores suelen responder en 1 día