Skip to content

On Windows, os.defpath incorrectly mentions C:\bin #91537

Closed as not planned
Closed as not planned
@arhadthedev

Description

@arhadthedev

According to the documentation:

os.defpath - The default search path used by exec*p* and spawn*p* if the environment doesn’t have a 'PATH' key.

However, on Windows is has a hardcoded C:\bin. Starting with Windows 2000, it has no sense because only admins can write outside of %USERPROFILE% and %TMP%. Moreover, I couldn't grep any Python machinery that adds this directory to PATH before exec/spawn.

This value appeared 1 Aug 1994 when neither standard paths nor access rights existed:

cpython/Lib/os.py

Lines 19 to 24 in 2979b01

_osindex = {
'posix': ('.', '..', '/', ':', ':/bin:/usr/bin'),
'dos': ('.', '..', '\\', ';', '.;C:\\bin'),
'nt': ('.', '..', '\\', ';', '.;C:\\bin'),
'mac': (':', '::', ':', ' ', ':'),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions