[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

Jason Fried report at bugs.python.org
Tue Oct 8 16:45:49 EDT 2019


New submission from Jason Fried <me at jasonfried.info>:

The standard contextmanager decorator produces a wrapper that itself can be used as a decorator

```
@contextmanager
def some_context():
    ...
    yield

@some_context()
def some_function():
    # we are inside a with some_context() now. 
    ...


```

When I created a version of asynccontextmanager internally before it was available in the  stdLib I copied this behavior and I have people internally to facebook using this behavior,  Was there a reason this behavior was not replicated to asynccontextmanager?  

I have a diff an tests to add

----------
components: Library (Lib)
messages: 354232
nosy: fried, yselivanov
priority: normal
severity: normal
status: open
title: @asynccontextmanager decorated functions are not callable like @contextmanager
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38415>
_______________________________________


More information about the Python-bugs-list mailing list