[stdlib] Fix `os.path.join` with trailing separator and add regression test by BlueDestination · Pull Request #6631 · modular/modular · GitHub
Skip to content

[stdlib] Fix os.path.join with trailing separator and add regression test#6631

Open
BlueDestination wants to merge 2 commits into
modular:mainfrom
BlueDestination:BlueDestination-patch-1
Open

[stdlib] Fix os.path.join with trailing separator and add regression test#6631
BlueDestination wants to merge 2 commits into
modular:mainfrom
BlueDestination:BlueDestination-patch-1

Conversation

@BlueDestination

Copy link
Copy Markdown

Linked issue

N/A — trivial fix

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • Performance improvement (includes benchmark results below)
  • Documentation update
  • New feature or public API (requires prior proposal or issue approval)
  • Refactor / internal cleanup (no user-visible change)
  • Build, CI, or tooling change

Motivation

Fix a bug where os.path.join() omitted a separator because it checked the wrong variable (path instead of joined_path).

What changed

  • mojo/stdlib/std/os/path/path.mojo: changed
    path.endswith(sep)joined_path.endswith(sep) in the
    multi-segment loop of join().
  • mojo/stdlib/test/os/path/test_join.mojo: added regression
    test join("path/", "to", "file").

Testing

All join tests pass locally, including the new regression case.

Checklist

  • The linked issue above has been reviewed by a maintainer and is
    agreed-upon, or this is a trivial fix that does not need prior
    approval
  • PR is small and focused — I've split larger changes into a sequence of
    smaller PRs where possible (see
    pull request sizes)
  • I ran ./bazelw run format to format my changes
  • I added or updated tests to cover my changes
  • If AI tools assisted with this contribution, I have included an
    Assisted-by: trailer in my commit message or this PR description (see
    AI Tool Use Policy)
    Assisted-by: DeepSeek

@BlueDestination BlueDestination requested a review from a team as a code owner May 30, 2026 19:10
@github-actions github-actions Bot added mojo-stdlib Tag for issues related to standard library waiting-on-review labels May 30, 2026
@github-actions

github-actions Bot commented May 30, 2026

Copy link
Copy Markdown

@BlueDestination

Copy link
Copy Markdown
Author

modular-cla-bot Bot added a commit to modular/cla that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mojo-stdlib Tag for issues related to standard library waiting-on-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant