Skip to content

Outdated os.linesep docs in os.py #136087

Closed
Closed

Description

@sobolevn

- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')

Docs claim that \r is a possible value for os.linesep, however, I can't find any code that actually sets it to \r.

But it can only be:

Docs:

.. data:: linesep

   The string used to separate (or, rather, terminate) lines on the current
   platform.  This may be a single character, such as ``'\n'`` for POSIX, or
   multiple characters, for example, ``'\r\n'`` for Windows. Do not use
   *os.linesep* as a line terminator when writing files opened in text mode (the
   default); use a single ``'\n'`` instead, on all platforms.

The internet says:

Windows: '\r\n'
Mac (OS 9-): '\r'
Mac (OS 10+): '\n'
Unix/Linux: '\n'

So, it looks like an outdated doc?

Linked PRs

Activity

  1. self-assigned this
    on Jun 29, 2025
  2. added a commit that references this issue on Jun 29, 2025
  3. changed the title [-]Outdated `os.linesep` docs in `os.py`?[/-] [+]Outdated `os.linesep` docs in `os.py`[/+] on Jun 29, 2025
  4. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Jun 29, 2025
  5. added a commit that references this issue on Jun 30, 2025
  6. added 2 commits that reference this issue on Jun 30, 2025
  7. added 2 commits that reference this issue on Jun 30, 2025
  8. added a commit that references this issue on Jul 11, 2025
  9. added a commit that references this issue on Jul 12, 2025
  10. added a commit that references this issue on Jul 13, 2025
  11. added a commit that references this issue on Aug 4, 2025
  12. added a commit that references this issue on Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions