Convert the path via "y" in Python 3, and rename the format alias to
cstr_argf to more accurately reflect what it means, i.e. a sequence of
non-null bytes. If "y" ends up being sufficient it's simpler (and
more efficient?) than a Py_buffer conversion, though it doesn't
support as many argument types.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
#if PY_MAJOR_VERSION < 3
static state_t state;
# define get_state(x) (&state)
#if PY_MAJOR_VERSION < 3
static state_t state;
# define get_state(x) (&state)
#else
# define get_state(x) ((state_t *) PyModule_GetState(x))
#else
# define get_state(x) ((state_t *) PyModule_GetState(x))
#endif // PY_MAJOR_VERSION >= 3
#endif // PY_MAJOR_VERSION >= 3
- if (!PyArg_ParseTuple(args, "s", &filename))
+ if (!PyArg_ParseTuple(args, cstr_argf, &filename))
return NULL;
struct stat st;
return NULL;
struct stat st;
- if (!PyArg_ParseTuple(args, "s", &filename))
+ if (!PyArg_ParseTuple(args, cstr_argf, &filename))
return NULL;
struct stat st;
return NULL;
struct stat st;
Py_buffer src, dest;
PyObject *py_src_n, *py_src_off, *py_dest_off;
Py_buffer src, dest;
PyObject *py_src_n, *py_src_off, *py_dest_off;
- if (!PyArg_ParseTuple(args, buf_argf "*OOw*O",
+ if (!PyArg_ParseTuple(args, cstr_argf "*OOw*O",
&src, &py_src_n, &py_src_off,
&dest, &py_dest_off))
return NULL;
&src, &py_src_n, &py_src_off,
&dest, &py_dest_off))
return NULL;