Raise an exception in the coroutine. Return next yielded value or raise StopIteration.
(self, typ, val=None, tb=None)
| 162 | |
| 163 | @abstractmethod |
| 164 | def throw(self, typ, val=None, tb=None): |
| 165 | """Raise an exception in the coroutine. |
| 166 | Return next yielded value or raise StopIteration. |
| 167 | """ |
| 168 | if val is None: |
| 169 | if tb is None: |
| 170 | raise typ |
| 171 | val = typ() |
| 172 | if tb is not None: |
| 173 | val = val.with_traceback(tb) |
| 174 | raise val |
| 175 | |
| 176 | def close(self): |
| 177 | """Raise GeneratorExit inside coroutine. |