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.
This commit is contained in:
parent
f520c05456
commit
9e473c28e4
|
@ -3033,12 +3033,8 @@ 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) || PyUnicode_Check(obj))
|
||||||
Py_INCREF(obj);
|
return PyUnicode_FromObject(obj);
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
if (PyUnicode_Check(obj))
|
|
||||||
return PyUnicode_AsEncodedString(obj, "utf8", "strict");
|
|
||||||
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
|
||||||
return _res;
|
return _res;
|
||||||
|
|
||||||
|
@ -3140,7 +3136,7 @@ static PyMethodDef File_methods[] = {
|
||||||
{"FSUpdateAlias", (PyCFunction)File_FSUpdateAlias, 1,
|
{"FSUpdateAlias", (PyCFunction)File_FSUpdateAlias, 1,
|
||||||
PyDoc_STR("(FSRef fromFile, FSRef target, AliasHandle alias) -> (Boolean wasChanged)")},
|
PyDoc_STR("(FSRef fromFile, FSRef target, AliasHandle alias) -> (Boolean wasChanged)")},
|
||||||
{"pathname", (PyCFunction)File_pathname, 1,
|
{"pathname", (PyCFunction)File_pathname, 1,
|
||||||
PyDoc_STR("(str|unicode|FSSpec|FSref) -> pathname")},
|
PyDoc_STR("(str|FSSpec|FSref) -> pathname")},
|
||||||
{NULL, NULL, 0}
|
{NULL, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue