MCPcopy Index your code
hub / github.com/python/cpython / _getshortpathname

Function _getshortpathname

Lib/test/test_ntpath.py:39–49  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

37else:
38 HAVE_GETSHORTPATHNAME = True
39 def _getshortpathname(path):
40 GSPN = ctypes.WinDLL("kernel32", use_last_error=True).GetShortPathNameW
41 GSPN.argtypes = [ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32]
42 GSPN.restype = ctypes.c_uint32
43 result_len = GSPN(path, None, 0)
44 if not result_len:
45 raise OSError("failed to get short path name 0x{:08X}"
46 .format(ctypes.get_last_error()))
47 result = ctypes.create_unicode_buffer(result_len)
48 result_len = GSPN(path, result, result_len)
49 return result[:result_len]
50
51def _norm(path):
52 if isinstance(path, (bytes, str, os.PathLike)):

Callers 1

test_realpath_cwdMethod · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…