You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the incorrect behavior you saw
If you use await asyncio.ensure_future inside deffered you will produce an error: builtins.RuntimeError: await wasn't used with future
Example to reproduce:
Run such s project like twistd -r asyncio -n web --path . and refresh page a few time, after a small delay you will see such error.
If you have a traceback, please paste it here; otherwise, delete this.
2023-04-17T19:08:32+0900 [twisted.internet.defer#critical] Unhandled error in Deferred:
2023-04-17T19:08:32+0900 [twisted.internet.defer#critical]
Traceback (most recent call last):
File "/test-twisted/env/lib/python3.11/site-packages/twisted/internet/defer.py", line 1697, in _inlineCallbacks
result = context.run(gen.send, result)
File "/test-twisted/test1.rpy", line 31, in _real
yield defer.Deferred.fromCoroutine(self._more_test(request))
File "/test-twisted/env/lib/python3.11/site-packages/twisted/internet/defer.py", line 1138, in fromCoroutine
return _cancellableInlineCallbacks(coro)
File "/test-twisted/env/lib/python3.11/site-packages/twisted/internet/defer.py", line 1857, in _cancellableInlineCallbacks
_inlineCallbacks(None, gen, status, _copy_context())
--- <exception caught here> ---
File "/test-twisted/test1.rpy", line 31, in _real
yield defer.Deferred.fromCoroutine(self._more_test(request))
File "/test-twisted/env/lib/python3.11/site-packages/twisted/internet/defer.py", line 1697, in _inlineCallbacks
result = context.run(gen.send, result)
File "/test-twisted/test1.rpy", line 25, in _more_test
await asyncio.ensure_future(self._some_background_task(request))
builtins.RuntimeError: await wasn't used with future
Describe the correct behavior you'd like to see asyncio.ensure_future should work as other async/await functions.
Testing environment
Operating System and Version; paste the output of these commands: Linux rainbow 6.2.5-gentoo #1 SMP PREEMPT_DYNAMIC Mon Mar 13 00:22:30 JST 2023 x86_64 AMD Ryzen 9 5900X 12-Core Processor AuthenticAMD GNU/Linux
but I can confirm on latest Debian as well.
Twisted version 22.10.0
Reactor: asyncio
Python 3.11.4
Other:
This issue blocks to use aiohttp inside twisted.
The text was updated successfully, but these errors were encountered:
Describe the incorrect behavior you saw
If you use
await asyncio.ensure_future
inside deffered you will produce an error:builtins.RuntimeError: await wasn't used with future
Example to reproduce:
Describe how to cause this behavior
Run such s project like
twistd -r asyncio -n web --path .
and refresh page a few time, after a small delay you will see such error.Describe the correct behavior you'd like to see
asyncio.ensure_future
should work as other async/await functions.Testing environment
Linux rainbow 6.2.5-gentoo #1 SMP PREEMPT_DYNAMIC Mon Mar 13 00:22:30 JST 2023 x86_64 AMD Ryzen 9 5900X 12-Core Processor AuthenticAMD GNU/Linux
but I can confirm on latest Debian as well.
Other:
This issue blocks to use aiohttp inside twisted.
The text was updated successfully, but these errors were encountered: