Commit 7edd0a9b authored by Mark Hammond's avatar Mark Hammond

Demonstrate and fix [ 783882 ] os.lstat crashes with Unicode filename.

Will also check in on the 2.3 branch.
parent 5301d9c1
...@@ -25,6 +25,8 @@ f.close() ...@@ -25,6 +25,8 @@ f.close()
# Test stat and chmod # Test stat and chmod
if os.stat(TESTFN_ENCODED) != os.stat(TESTFN_UNICODE): if os.stat(TESTFN_ENCODED) != os.stat(TESTFN_UNICODE):
print "os.stat() did not agree on the 2 filenames" print "os.stat() did not agree on the 2 filenames"
if os.lstat(TESTFN_ENCODED) != os.lstat(TESTFN_UNICODE):
print "os.lstat() did not agree on the 2 filenames"
os.chmod(TESTFN_ENCODED, 0777) os.chmod(TESTFN_ENCODED, 0777)
os.chmod(TESTFN_UNICODE, 0777) os.chmod(TESTFN_UNICODE, 0777)
......
...@@ -4607,7 +4607,7 @@ posix_lstat(PyObject *self, PyObject *args) ...@@ -4607,7 +4607,7 @@ posix_lstat(PyObject *self, PyObject *args)
return posix_do_stat(self, args, "et:lstat", lstat, NULL, NULL); return posix_do_stat(self, args, "et:lstat", lstat, NULL, NULL);
#else /* !HAVE_LSTAT */ #else /* !HAVE_LSTAT */
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
return posix_do_stat(self, args, "et:lstat", STAT, "u:lstat", _wstati64); return posix_do_stat(self, args, "et:lstat", STAT, "U:lstat", _wstati64);
#else #else
return posix_do_stat(self, args, "et:lstat", STAT, NULL, NULL); return posix_do_stat(self, args, "et:lstat", STAT, NULL, NULL);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment