summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/file
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-01-28 23:29:46 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-01-28 23:29:46 (GMT)
commit60ffc2bafc401f7bea0c9619ddeb968ba95cb1eb (patch)
tree8e8716b2faec8c59ac0fc74f054a154b2386b8f9 /Mac/Modules/file
parent47a6b13988a71b0ac0d471168138e31144bf1a32 (diff)
downloadcpython-60ffc2bafc401f7bea0c9619ddeb968ba95cb1eb.zip
cpython-60ffc2bafc401f7bea0c9619ddeb968ba95cb1eb.tar.gz
cpython-60ffc2bafc401f7bea0c9619ddeb968ba95cb1eb.tar.bz2
Added a missing INCREF in pathname().
Diffstat (limited to 'Mac/Modules/file')
-rw-r--r--Mac/Modules/file/_Filemodule.c4
-rw-r--r--Mac/Modules/file/filesupport.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
index 8309b35..f762e7e 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 26821dd..9d6005c 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);