Skip to content

Commit d67de0a

Browse files
authored
bpo-41428: Fix compiler warnings in unionobject.c (GH-22388)
Use Py_ssize_t type rather than int, to store lengths in unionobject.c. Fix warnings: Objects\unionobject.c(189,71): warning C4244: '+=': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(182,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(205,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data Objects\unionobject.c(437,1): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data
1 parent bbeb223 commit d67de0a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Objects/unionobject.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ union_richcompare(PyObject *a, PyObject *b, int op)
179179
static PyObject*
180180
flatten_args(PyObject* args)
181181
{
182-
int arg_length = PyTuple_GET_SIZE(args);
183-
int total_args = 0;
182+
Py_ssize_t arg_length = PyTuple_GET_SIZE(args);
183+
Py_ssize_t total_args = 0;
184184
// Get number of total args once it's flattened.
185185
for (Py_ssize_t i = 0; i < arg_length; i++) {
186186
PyObject *arg = PyTuple_GET_ITEM(args, i);
@@ -434,7 +434,7 @@ _Py_Union(PyObject *args)
434434
unionobject* result = NULL;
435435

436436
// Check arguments are unionable.
437-
int nargs = PyTuple_GET_SIZE(args);
437+
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
438438
for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {
439439
PyObject *arg = PyTuple_GET_ITEM(args, iarg);
440440
if (arg == NULL) {

0 commit comments

Comments
 (0)