Added a missing INCREF in pathname().
This commit is contained in:
parent
47a6b13988
commit
60ffc2bafc
|
@ -3026,8 +3026,10 @@ static PyObject *File_pathname(PyObject *_self, PyObject *_args)
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(_args, "O", &obj))
|
if (!PyArg_ParseTuple(_args, "O", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyString_Check(obj))
|
if (PyString_Check(obj)) {
|
||||||
|
Py_INCREF(obj);
|
||||||
return obj;
|
return obj;
|
||||||
|
}
|
||||||
if (PyUnicode_Check(obj))
|
if (PyUnicode_Check(obj))
|
||||||
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
|
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
|
||||||
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
||||||
|
|
|
@ -874,8 +874,10 @@ PyObject *obj;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(_args, "O", &obj))
|
if (!PyArg_ParseTuple(_args, "O", &obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyString_Check(obj))
|
if (PyString_Check(obj)) {
|
||||||
|
Py_INCREF(obj);
|
||||||
return obj;
|
return obj;
|
||||||
|
}
|
||||||
if (PyUnicode_Check(obj))
|
if (PyUnicode_Check(obj))
|
||||||
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
|
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
|
||||||
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
||||||
|
|
Loading…
Reference in New Issue