summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/file/filesupport.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/file/filesupport.py')
-rw-r--r--Mac/Modules/file/filesupport.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py
index 4f27963..b7df7eb 100644
--- a/Mac/Modules/file/filesupport.py
+++ b/Mac/Modules/file/filesupport.py
@@ -844,6 +844,21 @@ f = ManualGenerator("as_tuple", FSSpec_as_tuple_body)
f.docstring = lambda: "() -> (vRefNum, dirID, name)"
fsspec_methods.append(f)
+pathname_body = """
+PyObject *obj;
+
+if (!PyArg_ParseTuple(_args, "O", &obj))
+ return NULL;
+if (PyString_Check(obj))
+ return obj;
+if (PyUnicode_Check(obj))
+ return PyUnicode_AsEncodedString(obj, "utf8", "strict");
+_res = PyObject_CallMethod(obj, "as_pathname", NULL);
+return _res;
+"""
+f = ManualGenerator("pathname", pathname_body)
+f.docstring = lambda: "(str|unicode|FSSpec|FSref) -> pathname"
+functions.append(f)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)