-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inspect module does not implement introspection API for asynchronous generators #79940
Comments
The I propose to add % ./python
Python 3.8.0a0 (heads/fix-issue-getasyncgenstate:a24deae1e2, Jan 17 2019, 11:44:45)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> async def agen():
... x = 1
... yield x
... x += 1
... yield x
...
>>> ag = agen()
>>> inspect.getasyncgenstate(ag)
'AGEN_CREATED'
>>> inspect.getasyncgenlocals(ag)
{}
>>> ag.__anext__().__next__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration: 1
>>> inspect.getasyncgenstate(ag)
'AGEN_SUSPENDED'
>>> inspect.getasyncgenlocals(ag)
{'x': 1}
>>> ag.__anext__().__next__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration: 2
>>> inspect.getasyncgenstate(ag)
'AGEN_SUSPENDED'
>>> inspect.getasyncgenlocals(ag)
{'x': 2}
>>> ag.aclose().send(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
>>> inspect.getasyncgenstate(ag)
'AGEN_CLOSED'
>>> inspect.getasyncgenlocals(ag)
{} |
see also msg300475 |
I needed this today and was surprised that it wasn't implemented. I'll review the PR. |
…rking sockets (pythonGH-102605) Skip `TestGetAsyncGenState` and restoring of the default event loop policy in `test_inspect` if platform lacks working socket support. Fixes python#11590 Automerge-Triggered-By: GH:kumaraditya303
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
TestGetAsyncGenState
on wasm as it requires working sockets #102605The text was updated successfully, but these errors were encountered: