summaryrefslogtreecommitdiff
path: root/Lib/asyncio/windows_events.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/windows_events.py')
-rw-r--r--Lib/asyncio/windows_events.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index c4bffc4734..f311e46315 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -373,10 +373,17 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
**kwargs)
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