diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-02-02 17:36:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-02-02 17:36:31 (GMT) |
commit | 5d44c08f1c18583d568283170454bab0c11f8257 (patch) | |
tree | 3f8ce7f843bc3589aebdb2cc569f8a55202d3dab /Lib/asyncio/unix_events.py | |
parent | 7a66fc22ad62563d0907c2fc91229656acfa0dd6 (diff) | |
download | cpython-5d44c08f1c18583d568283170454bab0c11f8257.zip cpython-5d44c08f1c18583d568283170454bab0c11f8257.tar.gz cpython-5d44c08f1c18583d568283170454bab0c11f8257.tar.bz2 |
Issue #23353, asyncio: Workaround CPython bug #23353
Don't use yield/yield-from in an except block of a generator. Store the
exception and handle it outside the except block.
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 1fc39ab..75e7c9c 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -186,10 +186,18 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): self._child_watcher_callback, transp) try: yield from waiter - except: + except Exception as exc: + # Workaround CPython bug #23353: using yield/yield-from in an + # except block of a generator doesn't clear properly + # sys.exc_info() + err = exc + else: + err = None + + if err is not None: transp.close() yield from transp._wait() - raise + raise err return transp |