Skip to content

Commit 76ef749

Browse files
Andy Groverstratakis
authored andcommitted
python3: Use PyLong_* instead of PyInt_*
These are unified in Python 3, as described here: https://docs.python.org/3/howto/cporting.html#long-int-unification It should always be safe to use PyLongs in place of PyInts on Python 2. Signed-off-by: Andy Grover <agrover@redhat.com>
1 parent 4ebb091 commit 76ef749

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python-ethtool/etherinfo_obj.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ PyObject *_ethtool_etherinfo_getter(PyEtherInfo *self, PyObject *attr_o)
124124
addrlist = get_etherinfo_address(self, NLQRY_ADDR4);
125125
py_addr = get_last_ipv4_address(addrlist);
126126
if (py_addr) {
127-
return PyInt_FromLong(py_addr->prefixlen);
127+
return PyLong_FromLong(py_addr->prefixlen);
128128
}
129-
return PyInt_FromLong(0);
129+
return PyLong_FromLong(0);
130130
} else if( strcmp(attr, "ipv4_broadcast") == 0 ) {
131131
addrlist = get_etherinfo_address(self, NLQRY_ADDR4);
132132
py_addr = get_last_ipv4_address(addrlist);

python-ethtool/ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ static PyObject *__struct_desc_create_dict(struct struct_desc *table,
667667

668668
switch (d->size) {
669669
case sizeof(uint32_t):
670-
objval = PyInt_FromLong(*(uint32_t *)val);
670+
objval = PyLong_FromLong(*(uint32_t *)val);
671671
break;
672672
}
673673

@@ -712,7 +712,7 @@ static int __struct_desc_from_dict(struct struct_desc *table,
712712
PyErr_SetString(PyExc_IOError, buf);
713713
return -1;
714714
}
715-
*(uint32_t *)val = PyInt_AsLong(obj);
715+
*(uint32_t *)val = PyLong_AsLong(obj);
716716
break;
717717
default:
718718
snprintf(buf, sizeof(buf),

0 commit comments

Comments
 (0)