Issue 19827: Optimize socket.settimeout() and socket.setblocking(): avoid syscall (original) (raw)

Issue19827

Created on 2013-11-28 21:10 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
socket.patch vstinner,2013-11-28 21:10 review
Messages (3)
msg204698 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-11-28 21:10
Attached patch avoids a syscall on socket.setblocking() and socket.settimeout() when possible: use ioctl(FIONBIO) when available (not only on VMS), or use fcntl() but only call fcntl() twice if the flags changed. The fcntl() optimization was suggested by Peter Portante some months ago: https://mail.python.org/pipermail/python-dev/2013-January/123661.html See also the rejected issue #19813: "Add a new optional timeout parameter to socket.socket() constructor".
msg205169 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-12-03 22:49
LGTM. I know I've written similar code in Python. :-)
msg205176 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-03 23:45
New changeset 5f0d1aad7322 by Victor Stinner in branch 'default': Close #19827: On UNIX, setblocking() and settimeout() methods of socket.socket http://hg.python.org/cpython/rev/5f0d1aad7322
History
Date User Action Args
2022-04-11 14:57:54 admin set github: 64026
2013-12-03 23:45:18 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2013-12-03 22:49:28 gvanrossum set messages: +
2013-12-03 21:16:42 vstinner set nosy: + gvanrossum, pitrou, neologix
2013-11-28 21:10:09 vstinner create