"s" on Python 3 only converts Unicode strings, which is a little
inconvenient. "s*" converts from either.
Signed-off-by: Andy Grover <agrover(a)redhat.com>
---
python-ethtool/ethtool.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c
index 69e406b..28a2aec 100644
--- a/python-ethtool/ethtool.c
+++ b/python-ethtool/ethtool.c
@@ -120,7 +120,7 @@ static PyObject *get_hwaddress(PyObject *self __unused, PyObject
*args)
const char *devname;
char hwaddr[20];
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our request structure. */
@@ -162,7 +162,7 @@ static PyObject *get_ipaddress(PyObject *self __unused, PyObject
*args)
const char *devname;
char ipaddr[20];
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our request structure. */
@@ -288,7 +288,7 @@ static PyObject *get_flags (PyObject *self __unused, PyObject *args)
const char *devname;
int fd, err;
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our request structure. */
@@ -321,7 +321,7 @@ static PyObject *get_netmask (PyObject *self __unused, PyObject
*args)
const char *devname;
char netmask[20];
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our request structure. */
@@ -361,7 +361,7 @@ static PyObject *get_broadcast(PyObject *self __unused, PyObject
*args)
const char *devname;
char broadcast[20];
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our request structure. */
@@ -402,7 +402,7 @@ static PyObject *get_module(PyObject *self __unused, PyObject *args)
char buf[2048];
const char *devname;
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our control structures. */
@@ -472,7 +472,7 @@ static PyObject *get_businfo(PyObject *self __unused, PyObject *args)
char buf[1024];
const char *devname;
- if (!PyArg_ParseTuple(args, "s", &devname))
+ if (!PyArg_ParseTuple(args, "s*", &devname))
return NULL;
/* Setup our control structures. */
@@ -538,7 +538,7 @@ static int get_dev_value(int cmd, PyObject *args, void *value)
const char *devname;
int err = -1;
- if (PyArg_ParseTuple(args, "s", &devname))
+ if (PyArg_ParseTuple(args, "s*", &devname))
err = send_command(cmd, devname, value);
return err;
@@ -560,7 +560,7 @@ static int dev_set_int_value(int cmd, PyObject *args)
struct ethtool_value eval;
const char *devname;
- if (!PyArg_ParseTuple(args, "si", &devname, &eval.data))
+ if (!PyArg_ParseTuple(args, "s*i", &devname, &eval.data))
return -1;
return send_command(cmd, devname, &eval);
@@ -745,7 +745,7 @@ static PyObject *set_coalesce(PyObject *self __unused, PyObject
*args)
const char *devname;
PyObject *dict;
- if (!PyArg_ParseTuple(args, "sO", &devname, &dict))
+ if (!PyArg_ParseTuple(args, "s*O", &devname, &dict))
return NULL;
if (struct_desc_from_dict(ethtool_coalesce_desc, &coal, dict) != 0)
@@ -785,7 +785,7 @@ static PyObject *set_ringparam(PyObject *self __unused, PyObject
*args)
const char *devname;
PyObject *dict;
- if (!PyArg_ParseTuple(args, "sO", &devname, &dict))
+ if (!PyArg_ParseTuple(args, "s*O", &devname, &dict))
return NULL;
if (struct_desc_from_dict(ethtool_ringparam_desc, &ring, dict) != 0)
--
1.9.3