[Python-checkins] PC/_subprocess.c: Fix signed/unsigned comparison (GH-7446)

Victor Stinner webhook-mailer at python.org
Wed Jun 6 07:10:45 EDT 2018


https://github.com/python/cpython/commit/d098098ce1dcb02d18571551654cbe7b92d291a4
commit: d098098ce1dcb02d18571551654cbe7b92d291a4
branch: 2.7
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-06-06T13:10:41+02:00
summary:

PC/_subprocess.c: Fix signed/unsigned comparison (GH-7446)

Fix the following compiler warning on Windows:
..\PC\_subprocess.c(384): warning C4018: '>' : signed/unsigned mismatch

files:
M PC/_subprocess.c

diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index fc9aaa461132..66940ff7e4b8 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -381,7 +381,7 @@ getenvironment(PyObject* environment)
         }
         totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 +
                                                      vsize + 1 + 1;
-        if (totalsize > PyString_GET_SIZE(out)) {
+        if (totalsize > (size_t)PyString_GET_SIZE(out)) {
             size_t offset = p - PyString_AS_STRING(out);
             if (_PyString_Resize(&out, totalsize + 1024))
                 goto exit;



More information about the Python-checkins mailing list