Skip to content

Regression in Python 3.11 when explicitly passing None to FutureIter.throw #101326

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

Closed
hauntsaninja opened this issue Jan 25, 2023 · 3 comments
Closed
Labels
type-bug An unexpected behavior, bug, or error

Comments

@hauntsaninja
Copy link
Contributor

hauntsaninja commented Jan 25, 2023

Reported and commit identified by @alicederyn in python/typeshed#9586

Regression caused by #31973. Doesn't contain a news entry, so probably not intentional.

λ cat xxx.py
import asyncio
async def f():
  await asyncio.sleep(0)
async def g():
  await asyncio.gather(f(), f())

h = g()
h.send(None)
print(type(h))
h.throw(ValueError("some error"), None, None)

λ python3.10 xxx.py
/Users/shantanu/dev/cpython/xxx.py:5: DeprecationWarning: There is no current event loop
  await asyncio.gather(f(), f())
<class 'coroutine'>
Traceback (most recent call last):
  File "/Users/shantanu/dev/cpython/xxx.py", line 10, in <module>
    h.throw(ValueError("some error"), None, None)
  File "/Users/shantanu/dev/cpython/xxx.py", line 5, in g
    await asyncio.gather(f(), f())
ValueError: some error

λ python3.11 xxx.py
/Users/shantanu/dev/cpython/xxx.py:5: DeprecationWarning: There is no current event loop
  await asyncio.gather(f(), f())
<class 'coroutine'>
Traceback (most recent call last):
  File "/Users/shantanu/dev/cpython/xxx.py", line 10, in <module>
    h.throw(ValueError("some error"), None, None)
  File "/Users/shantanu/dev/cpython/xxx.py", line 5, in g
    await asyncio.gather(f(), f())
TypeError: throw() third argument must be a traceback

Linked PRs

@hauntsaninja hauntsaninja added the type-bug An unexpected behavior, bug, or error label Jan 25, 2023
@hauntsaninja
Copy link
Contributor Author

cc @asvetlov @kumaraditya303

@hauntsaninja
Copy link
Contributor Author

Thanks @alicederyn!

@alicederyn
Copy link

Thanks @hauntsaninja! Amazing turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants