Skip to content

bpo-21760: fix __file__ description #19097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 9, 2021
11 changes: 8 additions & 3 deletions Doc/reference/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,14 @@ the module.
.. attribute:: __file__
.. attribute:: __cached__

``__file__`` is optional. If set, this attribute's value must be a
string. The import system may opt to leave ``__file__`` unset if it
has no semantic meaning (e.g. a module loaded from a database).
``__file__`` is optional (if set, value must be a string). It indicates
the pathname of the file from which the module was loaded (if
loaded from a file), or the pathname of the shared libray file
for extension modules loaded dynamically from a shared library.
It might be missing for certain types of modules, such as C
modules that are statically linked into the interpreter, and the
import system may opt to leave it unset if it has no semantic
meaning (e.g. a module loaded from a database).

If ``__file__`` is set, it may also be appropriate to set the
``__cached__`` attribute which is the path to any compiled version of
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The description for __file__ fixed.
Patch by Furkan Onder