]> granicus.if.org Git - python/commitdiff
Added a missing INCREF in pathname().
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 28 Jan 2003 23:29:46 +0000 (23:29 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 28 Jan 2003 23:29:46 +0000 (23:29 +0000)
Mac/Modules/file/_Filemodule.c
Mac/Modules/file/filesupport.py

index 8309b35a6244b5278c56cad959a91de857dbb8f8..f762e7e8860f48a8284c6f74f288a0e0f5b26c32 100644 (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);
index 26821ddd69a0f3d06994396178493f7dd74305f2..9d6005cef6bb47f5bc08950921d576fe2dad0d1d 100644 (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);