Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Defaulted positional-only hook parameters are forwarded as keywords

Abierto
#774 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@adenzhou1350 ya está trabajando en esto.

Desde el 11/10/2026.

  • #775 de @adenzhou1350 — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
tooling

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytest-dev/pluggy

Todos los issues de pytest-dev/pluggy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.