summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-03-11 21:48:57 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-03-11 21:48:57 (GMT)
commitdded84802a0782960ba52a5d55b885fc9cc23a44 (patch)
tree5dc7e18c974492b60ec54f2874f688af797797da /Mac
parentd65ec37f4637c4584ce83974e0e424410b2bd873 (diff)
downloadcpython-dded84802a0782960ba52a5d55b885fc9cc23a44.zip
cpython-dded84802a0782960ba52a5d55b885fc9cc23a44.tar.gz
cpython-dded84802a0782960ba52a5d55b885fc9cc23a44.tar.bz2
Allow unicode pathnames where FSRefs are expected. Fixes 696253.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/file/_Filemodule.c7
-rw-r--r--Mac/Modules/file/filesupport.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c
index 8939437..d61172e 100644
--- a/Mac/Modules/file/_Filemodule.c
+++ b/Mac/Modules/file/_Filemodule.c
@@ -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;
}
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py
index 9d6005c..1237d22 100644
--- a/Mac/Modules/file/filesupport.py
+++ b/Mac/Modules/file/filesupport.py
@@ -280,8 +280,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;
}