diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6440,14 +6440,15 @@ If there is no limit, return -1."); static PyObject * posix_pathconf(PyObject *self, PyObject *args) { - PyObject *result = NULL; + PyObject *opath, *result = NULL; int name; char *path; - if (PyArg_ParseTuple(args, "sO&:pathconf", &path, + if (PyArg_ParseTuple(args, "O&O&:pathconf", PyUnicode_FSConverter, &opath, conv_path_confname, &name)) { long limit; + path = PyBytes_AS_STRING(opath); errno = 0; limit = pathconf(path, name); if (limit == -1 && errno != 0) { @@ -6459,6 +6460,7 @@ posix_pathconf(PyObject *self, PyObject } else result = PyLong_FromLong(limit); + Py_DECREF(opath); } return result; }