Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix :class:`socket.socket` to respect caller-specified proto over
auto-detection, which is not supported on platforms such as macOS.
4 changes: 2 additions & 2 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5746,8 +5746,8 @@ sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
#else
type = SOCK_STREAM;
#endif
#ifdef SO_PROTOCOL
if (proto == -1) {
#ifdef SO_PROTOCOL
int tmp;
socklen_t slen = sizeof(tmp);
if (getsockopt(fd, SOL_SOCKET, SO_PROTOCOL,
Expand All @@ -5758,10 +5758,10 @@ sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
set_error();
return -1;
}
}
#else
proto = 0;
#endif
}
}
}
else {
Expand Down
Loading