Content-Length: 362159 | pFad | http://github.com/python/cpython/pull/150273

84 gh-150274: Clarify module.__file__ documentation by RaghunandanKumar · Pull Request #150273 · python/cpython · GitHub
Skip to content

gh-150274: Clarify module.__file__ documentation#150273

Open
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-module-file-docs
Open

gh-150274: Clarify module.__file__ documentation#150273
RaghunandanKumar wants to merge 1 commit into
python:mainfrom
RaghunandanKumar:fix-module-file-docs

Conversation

@RaghunandanKumar
Copy link
Copy Markdown

@RaghunandanKumar RaghunandanKumar commented May 22, 2026

Summary

  • fix the module.__file__ section wording to describe a single optional attribute
  • clarify that import-loaded modules usually get an absolute path
  • note that callers should normalize the value if they require an absolute path

Issue

Testing

  • make -C Doc text SOURCES='reference/datamodel.rst' SPHINXOPTS='-q'

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels May 22, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs May 22, 2026
@RaghunandanKumar RaghunandanKumar changed the title Clarify module.__file__ documentation gh-150274: Clarify module.__file__ documentation May 22, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 22, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32817191 | 📁 Comparing 82666c7 against main (9df2b6c)

  🔍 Preview build  

1 file changed
± reference/datamodel.html

Comment on lines +1086 to +1088
For modules loaded from a file by the import system, it is usually an
absolute path. However, other loaders may set it to a different value, so
code that needs an absolute path should normalize it explicitly.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not explain anything. It just says "it can be anything and it depends on the loaders" so it does not help the reader more. This part needs to be removed.

Comment on lines +1076 to +1077
:attr:`!__file__` is an optional attribute that may or may not be set.
When it is set, it should be a :class:`str`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change the first sentence, it is correct. Only change the second.

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 23, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

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

Labels

awaiting changes docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/pull/150273

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy