[Python-checkins] r65902 - python/branches/release25-maint/Lib/test/test_os.py
Amaury Forgeot d'Arc
amauryfa at gmail.com
Wed Aug 20 17:42:53 CEST 2008
Is this change really useful for 2.5?
Even for 2.6, I don't see why unicode is necessary here.
And there is an implicit conversion from str to unicode, when root is
converted to LPCWSTR.
Since the root is something like c:\ it is not expected to cause problems tough.
> Modified: python/branches/release25-maint/Lib/test/test_os.py
> ==============================================================================
> --- python/branches/release25-maint/Lib/test/test_os.py (original)
> +++ python/branches/release25-maint/Lib/test/test_os.py Wed Aug 20 06:20:53 2008
> @@ -265,12 +265,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(test_support.TESTFN) == "NTFS":
--
Amaury Forgeot d'Arc
More information about the Python-checkins
mailing list