Skip to content

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

Closed

Description

@hauntsaninja

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

Activity

  1. hauntsaninja commented on Jan 25, 2023

    @hauntsaninja
    ContributorAuthor
  2. added 4 commits that reference this issue on Jan 25, 2023
  3. hauntsaninja commented on Jan 25, 2023

    @hauntsaninja
    ContributorAuthor

    Thanks @alicederyn!

  4. added a commit that references this issue on Jan 25, 2023
  5. alicederyn commented on Jan 26, 2023

    @alicederyn

    Thanks @hauntsaninja! Amazing turnaround!

  6. added a commit that references this issue on Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions