From: Jack Jansen Date: Tue, 28 Jan 2003 23:29:46 +0000 (+0000) Subject: Added a missing INCREF in pathname(). X-Git-Tag: v2.3c1~2207 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60ffc2bafc401f7bea0c9619ddeb968ba95cb1eb;p=thirdparty%2FPython%2Fcpython.git Added a missing INCREF in pathname(). --- diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index 8309b35a6244..f762e7e8860f 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -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); diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py index 26821ddd69a0..9d6005cef6bb 100644 --- a/Mac/Modules/file/filesupport.py +++ b/Mac/Modules/file/filesupport.py @@ -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);