PyDocs

Nav

Python Runtime Services

coroutine.throw

builtins

method
  • coroutine.throw(value)
  • coroutine.throw(type[, value[, traceback]])
Raises the specified exception in the coroutine. This method delegates to the throw() method of the iterator that caused the coroutine to suspend, if it has such a method. Otherwise, the exception is raised at the suspension point. The result (return value, StopIteration, or other exception) is the same as when iterating over the __await__() return value, described above. If the exception is not caught in the coroutine, it propagates back to the caller.
Changed in 3.12
  • 3.12: The second signature (type[, value[, traceback]]) is deprecated and may be removed in a future version of Python.
0 Examples
No examples for builtins/coroutine.throw.
See Also
No see-alsos for builtins/coroutine.throw
0 Notes
No notes for coroutine.throw