Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,8 @@ this approach.

.. attribute:: module.__file__

:attr:`!__file__` is an optional attribute that
may or may not be set. Both attributes should be a :class:`str` when they
are available.
:attr:`!__file__` is an optional attribute that may or may not be set.
When it is set, it should be a :class:`str`.
Comment on lines +1076 to +1077
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.


An optional attribute, :attr:`!__file__` indicates the pathname of the file
from which the module was loaded (if loaded from a file), or the pathname of
Expand All @@ -1084,6 +1083,9 @@ this approach.
modules that are statically linked into the interpreter, and the
:ref:`import system <importsystem>` may opt to leave it unset if it
has no semantic meaning (for example, a module loaded from a database).
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.
Comment on lines +1086 to +1088
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.


.. deprecated-removed:: 3.13 3.15
Setting ``__cached__`` on a module while failing to set
Expand Down
Loading