Some ntpath/posixpath functions unusable on foreign OS
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
The os.path docs intro includes:
Note: Since different operating systems have different path name conventions, there are several versions of this module in the standard library. The
os.pathmodule is always the path module suitable for the operating system Python is running on, and therefore usable for local paths. However, you can also import and use the individual modules if you want to manipulate a path that is always in one of the different formats. They all have the same interface:
posixpathfor UNIX-style pathsntpathfor Windows paths
But we don't explain that some of the functions in ntpath and posixpath aren't suitable for usage on a "foreign" OS, e.g. that using ntpath.realpath() from POSIX is a bad idea.
These functions are safe because they do purely lexical work:
basenamecommonpathcommonprefixdirnameisabsjoinnormcasenormpathsplitsplitdrivesplitrootsplitext
These functions are probably unsafe because they rely on details of the host OS (e.g. via the os module):
abspathexistslexistsexpanduserexpandvarsgetatimegetmtimegetctimegetsizeisfileisdirisjunctionislinkismountisdevdriverealpathrelpathsamefilesameopenfilesamestatsupports_unicode_filenames
Linked PRs
- gh-119772
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the os.path documentation intro linked in the issue and review the lexical and host-dependent function lists. Check linked PR gh-119772 before making changes. Done means the documentation clearly explains which ntpath and posixpath functions are safe on a foreign OS and which depend on the host OS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100