-
- Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
class MyExc(Exception): pass import itertools async def agenfn(): for i in itertools.count(): try: yield i except MyExc: pass agen = agenfn() try: agen.asend(None).send(None) except StopIteration as e: print(f"{e.value=}") athrow = agen.athrow(MyExc) try: athrow.throw(MyExc) except StopIteration as e: print(f"{e.value=}") try: athrow.throw(MyExc) except RuntimeError: print("good") except StopIteration as e: print(f"bad {e.value=}")outputs:
e.value=0 e.value=1 bad e.value=2 should output:
e.value=0 e.value=1 good CPython versions tested on:
3.8, 3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error