Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 852823d

Browse files
committed
Cleanup and correct a few ints to be Py_ssize_t.
1 parent abb3351 commit 852823d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

PC/_subprocess.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ gethandle(PyObject* obj, char* name)
329329
static PyObject*
330330
getenvironment(PyObject* environment)
331331
{
332-
int i, envsize;
332+
int i;
333+
Py_ssize_t envsize;
333334
PyObject* out = NULL;
334335
PyObject* keys;
335336
PyObject* values;
@@ -356,7 +357,7 @@ getenvironment(PyObject* environment)
356357
p = PyUnicode_AS_UNICODE(out);
357358

358359
for (i = 0; i < envsize; i++) {
359-
int ksize, vsize, totalsize;
360+
Py_ssize_t ksize, vsize, totalsize;
360361
PyObject* key = PyList_GET_ITEM(keys, i);
361362
PyObject* value = PyList_GET_ITEM(values, i);
362363

@@ -370,7 +371,7 @@ getenvironment(PyObject* environment)
370371
totalsize = (p - PyUnicode_AS_UNICODE(out)) + ksize + 1 +
371372
vsize + 1 + 1;
372373
if (totalsize > PyUnicode_GET_SIZE(out)) {
373-
int offset = p - PyUnicode_AS_UNICODE(out);
374+
Py_ssize_t offset = p - PyUnicode_AS_UNICODE(out);
374375
PyUnicode_Resize(&out, totalsize + 1024);
375376
p = PyUnicode_AS_UNICODE(out) + offset;
376377
}

0 commit comments

Comments
 (0)