future_safe & RuntimeWarning: coroutine '...' was never awaited
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par FutureResultE.from_iterable et l’exemple minimal de l’issue, puis examinez returns/_generated/futures/_future_result.py:44 et returns/future.py:594, où les avertissements apparaissent. Reproduisez le problème avec Python 3.7 et l’exemple de timeout en échec ; c’est terminé lorsque le Failure attendu reste présent tandis que les RuntimeWarnings unawaited-coroutine n’apparaissent plus.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hi!
I'm running sample code from https://returns.readthedocs.io/en/latest/pages/future.html#futureresult on python3.7
I've set timeout for AsyncClient to 0.01, expecting the function to always fail. That works correct, the result is <IOResult: <Failure: >>
But there are lots of RuntimeWarnings:
/.../returns/_generated/futures/_future_result.py:44: RuntimeWarning: coroutine 'async_map' was never awaited
container = await inner_value
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/.../returns/_generated/futures/_future_result.py:44: RuntimeWarning: coroutine 'future_safe.<locals>.factory' was never awaited
container = await inner_value
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/.../future.py:594: RuntimeWarning: coroutine 'async_map' was never awaited
return IOResult.from_result(await self._inner_value)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/.../returns/future.py:594: RuntimeWarning: coroutine 'future_safe.<locals>.factory' was never awaited
return IOResult.from_result(await self._inner_value)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
It is not a good idea to disable RuntimeWarnings, and i suspect this behaviour to be incorrect.
I think that the problem is inside the FutureResultE.from_iterable, the minimal working example is like this:
@future_safe
async def f1(x: float) -> float:
return x / 0
def f2() -> FutureResultE[Sequence[float]]:
return FutureResultE.from_iterable(
# changing range(3) -> range(1) removes RuntimeWarnings
[f1(x).map(lambda k: k + 1) for x in range(3)]
)
print(anyio.run(f2().awaitable))
- Langage dominant
- Python
- Étoiles
- 4.4k
- Forks
- 154
- Merge moyen
- 3 h 5 min
- PR mergées (30 j)
- 22
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de dry-python/returns
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
dry-python/returns#2394 · 1 réaction ·
-
Composing 0-argument functions Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
dry-python/returns#2365 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
dry-python/returns#2355 · 1 commentaire ·
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
dry-python/returns#2295 · 4 commentaires · 1 réaction ·
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
dry-python/returns#2253 · 2 commentaires ·
Toutes les issues de dry-python/returns
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
stephrobert/dsoxlab#238 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
sublimehq/package_control#1780 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
nwg-piotr/nwg-displays#145 ·