[Python-3000-checkins] r65901 - in python/branches/py3k: Lib/test/test_os.py

hirokazu.yamamoto python-3000-checkins at python.org
Wed Aug 20 06:17:25 CEST 2008


Author: hirokazu.yamamoto
Date: Wed Aug 20 06:17:24 2008
New Revision: 65901

Log:
Merged revisions 65900 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65900 | hirokazu.yamamoto | 2008-08-20 13:13:28 +0900 | 1 line
  
  fixed get_file_system in test_os.py ('path' is unicode on py3k and ansi on trunk)
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_os.py

Modified: python/branches/py3k/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k/Lib/test/test_os.py	(original)
+++ python/branches/py3k/Lib/test/test_os.py	Wed Aug 20 06:17:24 2008
@@ -299,12 +299,15 @@
     # systems support centiseconds
     if sys.platform == 'win32':
         def get_file_system(path):
-            import os
-            root = os.path.splitdrive(os.path.realpath("."))[0] + '\\'
+            root = os.path.splitdrive(os.path.abspath(path))[0] + '\\'
             import ctypes
-            kernel32 = ctypes.windll.kernel32
-            buf = ctypes.create_string_buffer("", 100)
-            if kernel32.GetVolumeInformationA(root, None, 0, None, None, None, buf, len(buf)):
+            from ctypes.wintypes import LPCWSTR, LPWSTR, DWORD
+            LPDWORD = ctypes.POINTER(DWORD)
+            f = ctypes.windll.kernel32.GetVolumeInformationW
+            f.argtypes = (LPCWSTR, LPWSTR, DWORD,
+                LPDWORD, LPDWORD, LPDWORD, LPWSTR, DWORD)
+            buf = ctypes.create_unicode_buffer("", 100)
+            if f(root, None, 0, None, None, None, buf, len(buf)):
                 return buf.value
 
         if get_file_system(support.TESTFN) == "NTFS":


More information about the Python-3000-checkins mailing list