Skip to content

Doc: Clarify os.fspath normalization and resolution behavior - #162722

Closed
anisayakmitra-in wants to merge 1 commit into
python:mainfrom
anisayakmitra-in:doc-fspath-normalization
Closed

anisayakmitra-in wants to merge 1 commit into
python:mainfrom
anisayakmitra-in:doc-fspath-normalization

Conversation

@anisayakmitra-in

Copy link
Copy Markdown

Description

Clarify in Doc/library/os.rst that os.fspath returns the file system representation of a path without performing path normalization, validation, or component resolution (such as . or .. or symlinks). Point users to os.path.normpath and pathlib.Path.resolve when path normalization or resolution is needed.

  • Issue: None (documentation improvement)

📚 Documentation-only change (no NEWS entry required).

Note that os.fspath only extracts the file system representation from a
PathLike object (or returns str/bytes unchanged) without performing path
normalization, validation, or component resolution.

Signed-off-by: ANISAYAK MITRA <266799942+anisayakmitra-in@users.noreply.github.com>
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Nov 27, 2026
@python-cla-bot

python-cla-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36205541 | 📁 Comparing bda5709 against main (5dbe2ac)

  🔍 Preview build  

1 file changed
± library/os.html

@picnixz

picnixz commented Nov 27, 2026

Copy link
Copy Markdown
Member

I don't see a reason for this change.

@picnixz picnixz closed this Nov 27, 2026
@picnixz

picnixz commented Nov 27, 2026

Copy link
Copy Markdown
Member

The current description is already clear: it says either does nothing or defer to ~os.PathLike.__fspath__.

@anisayakmitra-in

Copy link
Copy Markdown
Author

Thank you for reviewing, @picnixz! That makes total sense — the contract is already clear that it defers to fspath without additional processing. Closing this PR. Thank you for your time.

@anisayakmitra-in
anisayakmitra-in deleted the doc-fspath-normalization branch November 27, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants