mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-96348: Deprecate the 3-arg signature of coroutine.throw and generator.throw (GH-96428)
This commit is contained in:
parent
9a11ed8e50
commit
83a3de4e06
14 changed files with 125 additions and 21 deletions
|
@ -152,7 +152,7 @@ class _GeneratorContextManager(
|
|||
# tell if we get the same exception back
|
||||
value = typ()
|
||||
try:
|
||||
self.gen.throw(typ, value, traceback)
|
||||
self.gen.throw(value)
|
||||
except StopIteration as exc:
|
||||
# Suppress StopIteration *unless* it's the same exception that
|
||||
# was passed to throw(). This prevents a StopIteration
|
||||
|
@ -219,7 +219,7 @@ class _AsyncGeneratorContextManager(
|
|||
# tell if we get the same exception back
|
||||
value = typ()
|
||||
try:
|
||||
await self.gen.athrow(typ, value, traceback)
|
||||
await self.gen.athrow(value)
|
||||
except StopAsyncIteration as exc:
|
||||
# Suppress StopIteration *unless* it's the same exception that
|
||||
# was passed to throw(). This prevents a StopIteration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue