summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-23 17:08:21 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-23 17:08:21 (GMT)
commit9e473c28e4eb65e86fc11a5717cc6e7e1febd898 (patch)
treea0721bd9a36c643c62ae81d980931eb590f7e431 /Mac
parentf520c05456909ee3d2e5f9e47b3c85b0123d7c4b (diff)
downloadcpython-9e473c28e4eb65e86fc11a5717cc6e7e1febd898.zip
cpython-9e473c28e4eb65e86fc11a5717cc6e7e1febd898.tar.gz
cpython-9e473c28e4eb65e86fc11a5717cc6e7e1febd898.tar.bz2
SF patch# 1758570 by Jeffrey Yasskin, who writes:
I made Carbon.File.pathname return unicode, by analogy with macpath.abspath. There could easily be other bugs of the same sort in this file. The uses of PyString_FromString*() in particular look sketchy.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/file/_Filemodule.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
index ce4049f..8b4dd13 100644
--- a/Mac/Modules/file/_Filemodule.c
+++ b/Mac/Modules/file/_Filemodule.c
@@ -3033,12 +3033,8 @@ static PyObject *File_pathname(PyObject *_self, PyObject *_args)
if (!PyArg_ParseTuple(_args, "O", &obj))
return NULL;
- if (PyString_Check(obj)) {
- Py_INCREF(obj);
- return obj;
- }
- if (PyUnicode_Check(obj))
- return PyUnicode_AsEncodedString(obj, "utf8", "strict");
+ if (PyString_Check(obj) || PyUnicode_Check(obj))
+ return PyUnicode_FromObject(obj);
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
return _res;
@@ -3140,7 +3136,7 @@ static PyMethodDef File_methods[] = {
{"FSUpdateAlias", (PyCFunction)File_FSUpdateAlias, 1,
PyDoc_STR("(FSRef fromFile, FSRef target, AliasHandle alias) -> (Boolean wasChanged)")},
{"pathname", (PyCFunction)File_pathname, 1,
- PyDoc_STR("(str|unicode|FSSpec|FSref) -> pathname")},
+ PyDoc_STR("(str|FSSpec|FSref) -> pathname")},
{NULL, NULL, 0}
};