Added a missing INCREF in pathname().

This commit is contained in:
Jack Jansen 2003-01-28 23:29:46 +00:00
parent 47a6b13988
commit 60ffc2bafc
2 changed files with 6 additions and 2 deletions

View File

@ -3026,8 +3026,10 @@ static PyObject *File_pathname(PyObject *_self, PyObject *_args)
if (!PyArg_ParseTuple(_args, "O", &obj))
return NULL;
if (PyString_Check(obj))
if (PyString_Check(obj)) {
Py_INCREF(obj);
return obj;
}
if (PyUnicode_Check(obj))
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
_res = PyObject_CallMethod(obj, "as_pathname", NULL);

View File

@ -874,8 +874,10 @@ PyObject *obj;
if (!PyArg_ParseTuple(_args, "O", &obj))
return NULL;
if (PyString_Check(obj))
if (PyString_Check(obj)) {
Py_INCREF(obj);
return obj;
}
if (PyUnicode_Check(obj))
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
_res = PyObject_CallMethod(obj, "as_pathname", NULL);