diff options
author | Furkan Onder <furkantahaonder@gmail.com> | 2021-06-09 21:10:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-09 21:10:20 (GMT) |
commit | 878d7e4ee464913438fd59582bbb795e7e0fa387 (patch) | |
tree | 56adc0728cddc8d73fdbf74aeb5f7a46a6546762 /Doc/reference/import.rst | |
parent | 275d5f7957dbb56a6d5e1248addff210ee2e7270 (diff) | |
download | cpython-878d7e4ee464913438fd59582bbb795e7e0fa387.zip cpython-878d7e4ee464913438fd59582bbb795e7e0fa387.tar.gz cpython-878d7e4ee464913438fd59582bbb795e7e0fa387.tar.bz2 |
bpo-21760: fix __file__ description (GH-19097)
Diffstat (limited to 'Doc/reference/import.rst')
-rw-r--r-- | Doc/reference/import.rst | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index 2ef5b90..81a124f 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -603,9 +603,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 |