summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-09-12 16:25:38 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-09-12 16:25:38 (GMT)
commit1b699a5f00b427d95772349726d1ce1ab92718a7 (patch)
treeb65465f23b2997b7633c3064c43e377e60ff859e /Modules/posixmodule.c
parentdeadbf50e4cc3c541e706d5bf1aa73624bed36a6 (diff)
downloadcpython-1b699a5f00b427d95772349726d1ce1ab92718a7.zip
cpython-1b699a5f00b427d95772349726d1ce1ab92718a7.tar.gz
cpython-1b699a5f00b427d95772349726d1ce1ab92718a7.tar.bz2
Patch #790000: Allow os.access to handle Unicode file name.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 40526a4..f5b15d9 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1027,6 +1027,22 @@ posix_access(PyObject *self, PyObject *args)
int mode;
int res;
+#ifdef Py_WIN_WIDE_FILENAMES
+ if (unicode_file_names()) {
+ PyUnicodeObject *po;
+ if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) {
+ Py_BEGIN_ALLOW_THREADS
+ /* PyUnicode_AS_UNICODE OK without thread lock as
+ it is a simple dereference. */
+ res = _waccess(PyUnicode_AS_UNICODE(po), mode);
+ Py_END_ALLOW_THREADS
+ return(PyBool_FromLong(res == 0));
+ }
+ /* Drop the argument parsing error as narrow strings
+ are also valid. */
+ PyErr_Clear();
+ }
+#endif
if (!PyArg_ParseTuple(args, "si:access", &path, &mode))
return NULL;
Py_BEGIN_ALLOW_THREADS