[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2021-03-06 Thread Thomas Grainger


Change by Thomas Grainger :


--
nosy: +alex.gronholm, graingert

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2019-08-06 Thread George Zhang


Change by George Zhang :


--
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2019-08-05 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
nosy: +yselivanov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2019-08-05 Thread GeeVye


New submission from GeeVye :

In PEP 525, async generators were introduced. They use `.asend()` and 
`.athrow()` methods that return a "coroutine-like" object - specifically, a 
PyAsyncGenASend and PyAsyncGenAThrow respectively.

While these "coroutine-like" object implement `.send()`, `.throw()`, and 
`.close()`, they don't provide any attributes like normal coroutine objects do 
such as `cr_running` or `cr_await`.

When I use `inspect.getcoroutinestate()`, it raises an AttributeError on how 
there isn't a `cr_running` attribute / flag.

There is a workaround I use which is to wrap it with another coroutine as below:

>>> async def async_generator():
... yield
...
>>> async def wrap_coro(coro):
... return await coro
>>> agen = async_generator()
>>> asend = wrap_coro(agen.asend(None))

This seems like something that should be changed to make it more inline with 
normal coroutines / awaitables.

--
components: Demos and Tools
messages: 349093
nosy: GeeVye
priority: normal
severity: normal
status: open
title: No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend 
instances
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com