[Python-checkins] cpython: Issue #23834: Fix initial value of the socket timeout

victor.stinner python-checkins at python.org
Mon Apr 6 23:25:10 CEST 2015


https://hg.python.org/cpython/rev/7f54676348d3
changeset: 95458:7f54676348d3
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Apr 06 23:06:01 2015 +0200
summary:
 Issue #23834: Fix initial value of the socket timeout
Use _PyTime_FromSeconds() to initialize the default socket timeout to -1
second, instead of -1 nanosecond which causes rounding issues in
internal_select().
files:
 Modules/socketmodule.c | 4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2292,7 +2292,7 @@
 if (block == -1 && PyErr_Occurred())
 return NULL;
 
- s->sock_timeout = block ? -1 : 0;
+ s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0);
 internal_setblocking(s, block);
 
 Py_INCREF(Py_None);
@@ -4162,7 +4162,7 @@
 new = type->tp_alloc(type, 0);
 if (new != NULL) {
 ((PySocketSockObject *)new)->sock_fd = -1;
- ((PySocketSockObject *)new)->sock_timeout = -1;
+ ((PySocketSockObject *)new)->sock_timeout = _PyTime_FromSeconds(-1);
 ((PySocketSockObject *)new)->errorhandler = &set_error;
 }
 return new;
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /