]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport of change to os.access to encode Unicode file names with
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 13 Mar 2005 22:18:26 +0000 (22:18 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 13 Mar 2005 22:18:26 +0000 (22:18 +0000)
the file system encoding.

Lib/test/test_unicode_file.py
Misc/NEWS
Modules/posixmodule.c

index 87f73acaf1bb92603f37d1b25b0691cb5b6e3a45..6443efd7960bc456403daaf70c069667839ef036 100644 (file)
@@ -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()))
index b8b8a9ce72d3d0459e07efc29087e7ac5bef3a6b..fa88cad929c6dfa64a7c7d0e25fe9b750182ea32 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,11 @@ Tests
   name returned by socket.gethostname() a valid return value for getfqdn().
   Also clarified the wording of docs and docstring that this is the case.
 
+Extensions Modules
+------------------
+
+- os.access now supports Unicode path names on non-Win32 systems.
+
 
 What's New in Python 2.4.1c1?
 =============================
index b577ba947dad4c73a86989457296d3a7dbb26faf..2ee6a37c2eddb250b45c706d113c4944d1417c2b 100644 (file)
@@ -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);