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

Commit7cdc31a

Browse files
authored
bpo-38907: Suppress any exception when attempting to set V6ONLY. (GH-17864)
Fixes error attempting to bind to IPv4 address.
1 parent5136e72 commit7cdc31a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎Lib/http/server.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
importsys
104104
importtime
105105
importurllib.parse
106+
importcontextlib
106107
fromfunctoolsimportpartial
107108

108109
fromhttpimportHTTPStatus
@@ -1286,7 +1287,10 @@ def test(HandlerClass=BaseHTTPRequestHandler,
12861287
# ensure dual-stack is not disabled; ref #38907
12871288
classDualStackServer(ThreadingHTTPServer):
12881289
defserver_bind(self):
1289-
self.socket.setsockopt(socket.IPPROTO_IPV6,socket.IPV6_V6ONLY,0)
1290+
# suppress exception when protocol is IPv4
1291+
withcontextlib.suppress(Exception):
1292+
self.socket.setsockopt(
1293+
socket.IPPROTO_IPV6,socket.IPV6_V6ONLY,0)
12901294
returnsuper().server_bind()
12911295

12921296
test(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp