Skip to content

Commit a5fcc88

Browse files
authored
Omit unnecessary winerror check and improve comment
No need for checking winerror present as windows_events.py only imported on Windows (with check near top). Make comment more clear as to purpose of this patch.
1 parent b61114c commit a5fcc88

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/asyncio/windows_events.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,9 @@ def finish_accept(trans, key, ov):
556556
try:
557557
ov.getresult()
558558
except OSError as exc:
559-
# Fix bug when accepting a socket connection and ERROR_NETNAME_DELETED
560-
# occurs, leads this into a closing of the serving socket.
561-
if hasattr(exc, 'winerror') and exc.winerror in (
562-
_overlapped.ERROR_NETNAME_DELETED,
559+
# If ERROR_NETNAME_DELETED or ERROR_OPERATION_ABORTED occur,
560+
# do not close the serving socket.
561+
if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED,
563562
_overlapped.ERROR_OPERATION_ABORTED):
564563
conn.close()
565564
raise ConnectionResetError(*exc.args)

0 commit comments

Comments
 (0)