MagicStack / MagicStack/uvloop

TypeError: create_task() got an unexpected keyword argument 'eager_start'

Aperta
#754 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Cython
Stelle
11.9k
Fork
615
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

python 3.14.2 asyncio.create_task() accepts a kwarg eager_start: True. uvloop 0.22.1 does not and raises a type error:

  File "/Users/enda/Workspaces/project/api/src/prject/queries/counts.py", line 84, in _single_flight
    task = asyncio.create_task(_run(), name=f"single_flight:{key}", eager_start=True)
  File "/Users/enda/.local/share/uv/python/cpython-3.14.2-macos-aarch64-none/lib/python3.14/asyncio/tasks.py", line 395, in create_task
    return loop.create_task(coro, **kwargs)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "uvloop/loop.pyx", line 1415, in uvloop.loop.Loop.create_task
TypeError: create_task() got an unexpected keyword argument 'eager_start'

I understand that "accept but ignore-with-a-warning" is not a desirable approach as developers will expect that passing this in as True will cause the task to start eagerly. However, at present the first sentence of the project "uvloop is a fast, drop-in replacement of the built-in asyncio event loop. " is no longer100% accurate and that's not desired either.

I've only recently become aware of eager_start but it /seems/ to have been in discussion for over 18 months: https://discuss.python.org/t/make-asyncio-eager-task-factory-default/75164 (and uvloop gets a mention in there).

As I don't know what is involved in accepting and respecting an eager_start=True I don't want to say what I expect this issue to amount to, but it made its way pasting our testing as we were not using uvloop in the original tests which covered our _single_flight code, but our deployed code hit it. Clearly we have now fixed that testing oversite but others may experience this too.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Direzione di ricerca

Inizia da uvloop.loop.Loop.create_task in loop.pyx, dove il traceback mostra che l’argomento denominato eager_start di Python 3.14 viene rifiutato, e confrontalo con il comportamento di asyncio.create_task. Determina come uvloop dovrebbe accettare e rispettare eager_start=True senza limitarsi a ignorarlo; il lavoro è completato quando la chiamata segnalata funziona con uvloop con la semantica eager-start prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.