Skip to content

Support @inlineCallbacks on async def functions #9972

@twisted-trac

Description

@twisted-trac
graingert's avatar @graingert reported
Trac ID trac#9972
Type enhancement
Created 2020-09-24 08:17:59Z
Branch https://github.com/twisted/twisted/tree/9972-inlinecallbacks-async-def

In the creation of #9939 I found that it was necessary to create a decorator to allow convenient use of async def functions where there were previously @defer.inlineCallback functions

from twisted.internet import defer

@defer.inlineCallbacks
async def ham(spam, eggs):
    await treq.get("https://example.com")

This is useful because async with and async for are only usable in an async def context.

Searchable metadata
trac-id__9972 9972
type__enhancement enhancement
reporter__graingert graingert
priority__normal normal
milestone__None None
branch__9972_inlinecallbacks_async_def 9972-inlinecallbacks-async-def
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__None None
time__1600935479997788 1600935479997788
changetime__1612245017560019 1612245017560019
version__None None
owner__twm twm

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions