Appeler une coroutine sans await ne l'exécute pas à moitié — elle ne s'exécute pas du tout.Calling a coroutine without await doesn't half-run it — it doesn't run at all.
Le numéro précédent l'a établi : appeler une fonction async def crée un objet coroutine en attente, sans exécuter son corps. La conséquence directe, et la plus silencieuse de toute la série, est celle-ci : si ce coro() n'est jamais donné à await, à asyncio.gather, ou à asyncio.create_task, l'objet reste en attente pour toujours — son corps ne s'exécute JAMAIS, ni maintenant, ni plus tard. Aucune exception n'est levée. Le seul signal est un RuntimeWarning affiché sur stderr, facile à noyer dans des logs bruyants, qui dit littéralement ce qui s'est passé : « coroutine was never awaited ».The previous issue established it: calling an async def function creates a waiting coroutine object without running its body. The direct, and most silent, consequence in this entire series is this: if that coro() is never handed to await, to asyncio.gather, or to asyncio.create_task, the object stays waiting forever — its body NEVER executes, not now, not later. No exception is raised. The only signal is a RuntimeWarning printed to stderr, easy to drown in noisy logs, which literally says what happened: 'coroutine was never awaited'.
import asyncio async def enregistrer_evenement(nom): print(f"écriture de {nom} en base...") await asyncio.sleep(0.1) print(f"{nom} enregistré") async def main(): enregistrer_evenement("connexion_utilisateur") # PAS de await ici print("suite du programme") asyncio.run(main()) # affiche seulement : # suite du programme # fichier.py:N: RuntimeWarning: coroutine 'enregistrer_evenement' was never awaited # # "écriture de connexion_utilisateur en base..." ne s'affiche JAMAIS -- # le corps de la coroutine n'a tout simplement pas commencé à s'exécuter.
Un RuntimeWarning: coroutine was never awaited n'est jamais du bruit à ignorer — c'est le signalement exact d'un morceau de code qui n'a jamais tourné.A RuntimeWarning: coroutine was never awaited is never noise to ignore — it's the exact report of a piece of code that never ran.