Skip to content

gh-150880: Clarify DirEntry.path construction semantics#153218

Merged
zooba merged 1 commit into
python:mainfrom
zainnadeem786:docs/clarify-direntry-path-semantics
Jul 6, 2026
Merged

gh-150880: Clarify DirEntry.path construction semantics#153218
zooba merged 1 commit into
python:mainfrom
zainnadeem786:docs/clarify-direntry-path-semantics

Conversation

@zainnadeem786

@zainnadeem786 zainnadeem786 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

This is a documentation-only follow-up to GH-152906.

After the Windows wildcard normalization fix was merged, follow-up discussion highlighted that os.DirEntry.path intentionally preserves the original os.scandir() argument rather than a normalized path.

This PR clarifies the documented semantics of DirEntry.path, including:

  • DirEntry.path is constructed from the original os.scandir() argument and entry.name.
  • Relative scandir() arguments produce relative DirEntry.path values.
  • Changing the current working directory after creating the iterator can affect how relative DirEntry.path values resolve.
  • On some platforms, a path accepted for enumeration may not necessarily produce a valid path when later joined with the filename.

This PR is documentation only and does not change runtime behavior.

@zooba

zooba commented Jul 6, 2026

Copy link
Copy Markdown
Member

LGTM, thanks!

@zooba zooba added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes needs backport to 3.13 bugs and security fixes labels Jul 6, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33463557 | 📁 Comparing d269643 against main (4221ce7)

  🔍 Preview build  

1 file changed
± library/os.html

@zooba zooba merged commit 53661af into python:main Jul 6, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jul 6, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @zainnadeem786 for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

GH-153219 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 6, 2026
@bedevere-app

bedevere-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

GH-153220 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 6, 2026
@bedevere-app

bedevere-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

GH-153221 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 6, 2026
zooba pushed a commit that referenced this pull request Jul 6, 2026
…3218) (GH-153220)

gh-150880: Clarify DirEntry.path construction semantics (GH-153218)
(cherry picked from commit 53661af)

Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
zooba pushed a commit that referenced this pull request Jul 6, 2026
…3218) (GH-153221)

gh-150880: Clarify DirEntry.path construction semantics (GH-153218)
(cherry picked from commit 53661af)

Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
zooba pushed a commit that referenced this pull request Jul 6, 2026
…3218) (GH-153219)

gh-150880: Clarify DirEntry.path construction semantics (GH-153218)
(cherry picked from commit 53661af)

Co-authored-by: Zain Nadeem <zainnadeemzainnadeem80@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants