mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Allow unicode pathnames where FSRefs are expected. Fixes 696253.
This commit is contained in:
parent
d65ec37f46
commit
dded84802a
3 changed files with 15 additions and 4 deletions
|
@ -3222,8 +3222,11 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
|
|||
|
||||
#if TARGET_API_MAC_OSX
|
||||
/* On OSX we now try a pathname */
|
||||
if ( PyString_Check(v) ) {
|
||||
if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) {
|
||||
if ( PyString_Check(v) || PyUnicode_Check(v)) {
|
||||
char *path = NULL;
|
||||
if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
|
||||
return NULL;
|
||||
if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
|
||||
PyMac_Error(err);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue