[Python-checkins] cpython: Fix conversion from Py_ssize_t to int.

richard.oudkerk python-checkins at python.org
Sat Sep 7 18:42:43 CEST 2013


http://hg.python.org/cpython/rev/c116b658aede
changeset:   85591:c116b658aede
user:        Richard Oudkerk <shibturn at gmail.com>
date:        Sat Sep 07 17:40:45 2013 +0100
summary:
  Fix conversion from Py_ssize_t to int.

files:
  Modules/_multiprocessing/multiprocessing.c |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
--- a/Modules/_multiprocessing/multiprocessing.c
+++ b/Modules/_multiprocessing/multiprocessing.c
@@ -99,13 +99,15 @@
 {
     HANDLE handle;
     Py_buffer buf;
-    int ret;
+    int ret, length;
 
     if (!PyArg_ParseTuple(args, F_HANDLE "y*:send" , &handle, &buf))
         return NULL;
 
+    length = (int)Py_MIN(buf.len, INT_MAX);
+
     Py_BEGIN_ALLOW_THREADS
-    ret = send((SOCKET) handle, buf.buf, buf.len, 0);
+    ret = send((SOCKET) handle, buf.buf, length, 0);
     Py_END_ALLOW_THREADS
 
     PyBuffer_Release(&buf);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list