Skip to content

bpo-37412: pythoninfo: add Windows long paths #14434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,29 @@ def collect_subprocess(info_add):
copy_attributes(info_add, subprocess, 'subprocess.%s', ('_USE_POSIX_SPAWN',))


def collect_windows(info_add):
try:
import ctypes
except ImportError:
return

if not hasattr(ctypes, 'WinDLL'):
return

ntdll = ctypes.WinDLL('ntdll')
BOOLEAN = ctypes.c_ubyte

try:
RtlAreLongPathsEnabled = ntdll.RtlAreLongPathsEnabled
except AttributeError:
res = '<function not available>'
else:
RtlAreLongPathsEnabled.restype = BOOLEAN
RtlAreLongPathsEnabled.argtypes = ()
res = bool(RtlAreLongPathsEnabled())
info_add('windows.RtlAreLongPathsEnabled', res)


def collect_info(info):
error = False
info_add = info.add
Expand Down Expand Up @@ -684,6 +707,7 @@ def collect_info(info):
collect_testcapi,
collect_time,
collect_tkinter,
collect_windows,
collect_zlib,

# Collecting from tests should be last as they have side effects.
Expand Down