• Brian Curtin's avatar
    Fix #9333. Expose os.symlink on Windows only when usable. · 52173d49
    Brian Curtin authored
    In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege
    is an account privilege that is required to be held by the user. Not only
    must the privilege be enabled for the account, the activated privileges for
    the currently running application must be adjusted to enable the requested
    privilege.
    
    Rather than exposing an additional function to be called prior to the user's
    first os.symlink call, we handle the AdjustTokenPrivileges Windows API call
    internally and only expose os.symlink when the privilege escalation was
    successful.
    
    Due to the change of only exposing os.symlink when it's available, we can
    go back to the original test skipping methods of checking via `hasattr`.
    52173d49
test_sysconfig.py 11.2 KB