GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [doc] Behavior of os.path.join does not match documentation · Issue #77607 · python/cpython

[doc] Behavior of os.path.join does not match documentation #77607

New issue
Copy link
New issue
Copy link
Closed
Closed
[doc] Behavior of os.path.join does not match documentation#77607
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc direasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

MichaelKlatt
mannequin
opened on May 4, 2018
Issue body actions
BPO 33426
Nosy @zware, @Rainald62, @DonnaDia
PRs
  • bpo-33426: [doc] Behavior of os.path.join does not match documentation #28003
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-05-04.18:39:06.316>
    labels = ['easy', 'type-bug', '3.9', '3.10', '3.11', 'library', 'docs']
    title = '[doc] Behavior of os.path.join does not match documentation'
    updated_at = <Date 2021-09-02.08:33:07.143>
    user = 'https://bugs.python.org/MichaelKlatt'

    bugs.python.org fields:

    activity = <Date 2021-09-02.08:33:07.143>
    actor = 'Rainald Koch'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2018-05-04.18:39:06.316>
    creator = 'Michael Klatt'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33426
    keywords = ['patch', 'easy']
    message_count = 5.0
    messages = ['316184', '316194', '316223', '400436', '400903']
    nosy_count = 6.0
    nosy_names = ['SilentGhost', 'docs@python', 'zach.ware', 'Michael Klatt', 'Rainald Koch', 'DonnaDia']
    pr_nums = ['28003']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33426'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    • PR: gh-77607: Rephrase documentation of os.path.join() #98995
    • PR: gh-77607: Improve accuracy of os.path.join docs #101406
    • PR: [3.11] gh-77607: Improve accuracy of os.path.join docs (GH-101406) #101451
    • PR: [3.10] gh-77607: Improve accuracy of os.path.join docs (GH-101406) #101452

    Activity

    1. MichaelKlatt commented on May 4, 2018

      @MichaelKlatt
      MichaelKlattmannequin
      on May 4, 2018
      MannequinAuthor
      More actions

      The behavior of os.path.join() regarding path separators does not match the documentation. This affects Python 3.6, and goes back to at least Python 2.7.

      From the documenation:

      "The return value is the concatenation of path and any members of *paths with exactly one directory separator (os.sep) following each non-empty part except the last, meaning that the result will only end in a separator if the last part is empty."

      To me, this means that join will remove extraneous separators from the path, and that the only way to produce a trailing separator is to use join "" as the final path segment.

      I expect os.path.join("/abc//", "def/") to produce the string "/abc/def" based on the documentation, but what it actually produces is "abc//def/".

    2. MichaelKlatt
      assigned
      docspython
      on May 4, 2018
    3. MichaelKlatt
      added
      docsDocumentation in the Doc dirDocumentation in the Doc dir
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on May 4, 2018
    4. SilentGhost commented on May 5, 2018

      @SilentGhost
      SilentGhostmannequin
      on May 5, 2018
      Mannequin
      More actions

      your example actually produces '/abc//def/'.

      However, I'm not sure where do you get the idea that it should clean up internal directory separators or do anything at all with the strings in paths. To me it reads like it's concatenating arguments skipping over the empty ones unless it's also the last one.

      In any case, what would you propose to fix the language to describe the behaviour more clear?

    5. MichaelKlatt commented on May 5, 2018

      @MichaelKlatt
      MichaelKlattmannequin
      on May 5, 2018
      MannequinAuthor
      More actions

      For me, the ambiguity is due to the phrases "exactly one directory separator" and "the only way to produce a trailing separator".

      I would suggest:

      "The return value is the concatenation of path and any members of *paths so that there is a directory separator (os.sep) following each part except the last. An empty part is ignored unless it is the last part, in which case the result will end in a separator."

      Or:

      "The return value is the concatenation of path and any members of *paths such that there is guaranteed to be a directory separator (os.sep) following each part except the last. An empty part is ignored unless it is the last part, in which case the result will end in a separator."

    6. iritkatriel
      added
      easy
      3.9 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      3.11only security fixesonly security fixes
      on Aug 9, 2021
    7. iritkatriel
      changed the title [-]Behavior of os.path.join does not match documentation[/-] [+][doc] Behavior of os.path.join does not match documentation[/+] on Aug 9, 2021
    8. DonnaDia commented on Aug 27, 2021

      @DonnaDia
      DonnaDiamannequin
      on Aug 27, 2021
      Mannequin
      More actions

      Hi, I'm working on it. I will provide the pull request within 3 days.

    9. Rainald62 commented on Sep 2, 2021

      @Rainald62
      Rainald62mannequin
      on Sep 2, 2021
      Mannequin
      More actions

      Minimal changes that would largely reduce the likelihood of being misunderstood: Remove "intelligently" or replace "following" by "added after".

    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. hauntsaninja
      added 2 commits that reference this issue on Jan 29, 2023

      pythongh-77607: Improve accuracy of os.path.join docs

      392c285

      gh-77607: Improve accuracy of os.path.join docs (#101406)

      909a674
    12. miss-islington
      added 4 commits that reference this issue on Jan 31, 2023

      pythongh-77607: Improve accuracy of os.path.join docs (pythonGH-101406)

      51b00e2

      pythongh-77607: Improve accuracy of os.path.join docs (pythonGH-101406)

      46a47ac

      gh-77607: Improve accuracy of os.path.join docs (GH-101406)

      f36c272

      gh-77607: Improve accuracy of os.path.join docs (GH-101406)

      a79dd88
    13. hauntsaninja
      closed this as completedon Jan 31, 2023
    14. mdboom
      added a commit that references this issue on Jan 31, 2023

      pythongh-77607: Improve accuracy of os.path.join docs (python#101406)

      1a51ee1
    15. carljm
      added a commit that references this issue on Jan 31, 2023

      Merge branch 'main' into inlinecomp2

      ed3209b
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifedocsDocumentation in the Doc dirDocumentation in the Doc direasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.