summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-03-08 09:10:29 +0000
committerMartin v. Löwis <martin@v.loewis.de>2005-03-08 09:10:29 +0000
commit2f1eff98d96c788688b10af725cf5748813fd382 (patch)
tree8f0c09adb2f93ad69ded0503ba5b29384e8526df
parentdb1c0d8a21690779dcf58253cf29f0aa0d1109e6 (diff)
downloadcpython-2f1eff98d96c788688b10af725cf5748813fd382.tar.gz
Convert file names of posix.access according to the file system encoding.
-rw-r--r--Lib/test/test_unicode_file.py2
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/posixmodule.c3
3 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index 87f73acaf1..6443efd796 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -44,8 +44,10 @@ class TestUnicodeFiles(unittest.TestCase):
def _do_single(self, filename):
self.failUnless(os.path.exists(filename))
self.failUnless(os.path.isfile(filename))
+ self.failUnless(os.access(filename, os.R_OK))
self.failUnless(os.path.exists(os.path.abspath(filename)))
self.failUnless(os.path.isfile(os.path.abspath(filename)))
+ self.failUnless(os.access(os.path.abspath(filename), os.R_OK))
os.chmod(filename, 0777)
os.utime(filename, None)
os.utime(filename, (time.time(), time.time()))
diff --git a/Misc/NEWS b/Misc/NEWS
index 3db47a3df7..e387e63f5b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -47,6 +47,8 @@ Core and builtins
Extension Modules
-----------------
+- os.access now supports Unicode path names on non-Win32 systems.
+
- Patches #925152, #1118602: Avoid reading after the end of the buffer
in pyexpat.GetInputContext.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2d3eaa39cb..1ca131e337 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1113,7 +1113,8 @@ posix_access(PyObject *self, PyObject *args)
PyErr_Clear();
}
#endif
- if (!PyArg_ParseTuple(args, "si:access", &path, &mode))
+ if (!PyArg_ParseTuple(args, "eti:access",
+ Py_FileSystemDefaultEncoding, &path, &mode))
return NULL;
Py_BEGIN_ALLOW_THREADS
res = access(path, mode);