Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a2247c

Browse files
authored
bpo-32622: Normalize ENOTCONN to ConnectionError on macOS (GH-5369)
On mac, sendfile throws ENOTCONN on a repeated sendfile call ifthe connection is closed. Normalize it to behave like other systems.
1 parent47c0b1f commit2a2247c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎Lib/asyncio/unix_events.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,17 @@ def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
362362
fd,sock,fileno,
363363
offset,count,blocksize,total_sent)
364364
exceptOSErrorasexc:
365+
if (registered_fdisnotNoneand
366+
exc.errno==errno.ENOTCONNand
367+
type(exc)isnotConnectionError):
368+
# If we have an ENOTCONN and this isn't a first call to
369+
# sendfile(), i.e. the connection was closed in the middle
370+
# of the operation, normalize the error to ConnectionError
371+
# to make it consistent across all Posix systems.
372+
new_exc=ConnectionError(
373+
"socket is not connected",errno.ENOTCONN)
374+
new_exc.__cause__=exc
375+
exc=new_exc
365376
iftotal_sent==0:
366377
# We can get here for different reasons, the main
367378
# one being 'file' is not a regular mmap(2)-like

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp