8000 Forgot something. · esoma/cpython@3456205 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3456205

Browse files
committed
Forgot something.
1 parent e184e95 commit 3456205

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Lib/asyncio/windows_events.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,13 +768,23 @@ def _register(self, ov, obj, callback):
768768
f = _OverlappedFuture(ov, loop=self._loop)
769769
if f._source_traceback:
770770
del f._source_traceback[-1]
771+
self._register_early_out(f, ov, callback)
772+
# Register the overlapped operation for later. Note that
773+
# we only store obj to prevent it from being garbage
774+
# collected too early.
775+
self._cache[ov.address] = (f, ov, obj, callback)
776+
return f
777+
778+
def _register_early_out(self, f, ov, callback):
771779
if not ov.pending:
772780
# The operation has completed, so no need to postpone the
773781
# work. We cannot take this short cut if we need the
774782
# NumberOfBytes, CompletionKey values returned by
775783
# PostQueuedCompletionStatus().
776784
try:
777785
value = callback(None, None, ov)
786+
except _Retry as retry:
787+
return self._register_early_out(f, retry.ov, retry.callback)
778788
except OSError as e:
779789
f.set_exception(e)
780790
else:
@@ -78 7972 5,12 +795,6 @@ def _register(self, ov, obj, callback):
785795
# OVERLAPPED object, otherwise the memory is freed and Windows may
786796
# read uninitialized memory.
787797

788-
# Register the overlapped operation for later. Note that
789-
# we only store obj to prevent it from being garbage
790-
# collected too early.
791-
self._cache[ov.address] = (f, ov, obj, callback)
792-
return f
793-
794798
def _unregister(self, ov):
795799
"""Unregister an overlapped object.
796800

0 commit comments

Comments
 (0)
0