Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

How to handle keyword-only arguments

Aperta
#742 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bluetech ci sta già lavorando.

Dal 25/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Currently pluggy ignores keyword-only arguments in specs and impls.

The reason historically is that _multicall only called hookimpls using positional arguments (tuple) as an optimization(?), but keyword-only arguments can't be passed positionally.

Since 51ec4486b9d47da944725b0326a412cf9b7518bf however, if a hookimpl function declares a default then we do pass kwargs, so it's possible to support keyword-only.

For specs, supporting keyword-only is less of an issue, since it's not actually called, so it doesn't actually matter.

In pluggy callers are required to pass parameters by keyword so keyword-only or not doesn't make a difference.

Overall, there is no reason to define a keyword-only parameter in either spec or impl, it only has a downside of making calls a bit slower. But I think the current situation where they're just ignored is not very nice. So we can go with either of these:

  1. Support them.
  2. Reject them (validation).

Since "Support them" is a small performance trap, it seems like 2 is better, unless we can make the performance equivalent, which I will look into.

Lingua principale
Python
Stelle
1.7k
Fork
170
Merge medio
1g 18h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pytest-dev/pluggy

Tutte le issue di pytest-dev/pluggy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.