• EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

Esta tradução de máquina é fornecida para sua comodidade.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

Criar um problema

Informações ausentes ao usar ensure_future (Python)

Problema

Informações detalhadas trace de função não aparecem ao usar asyncio.ensure_future em corrotinas.

Solução

Os futuros criados a partir de ensure_future devem ser aguardados na mesma corrotina em que foram criados. Por exemplo, na seção Before , await não está presente com ensure_future, o que resultaria na falta de informações:

Before:

import asyncio
async def foo():
ensure_future(bar())
async def bar():
await asyncio.sleep(0.5)

After:

import asyncio
async def foo():
await ensure_future(bar())
async def bar():
await asyncio.sleep(0.5)
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.