File tree 2 files changed +10
-3
lines changed
Misc/NEWS.d/next/Documentation
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -603,9 +603,14 @@ the module.
603
603
.. attribute :: __file__
604
604
.. attribute :: __cached__
605
605
606
- ``__file__ `` is optional. If set, this attribute's value must be a
607
- string. The import system may opt to leave ``__file__ `` unset if it
608
- has no semantic meaning (e.g. a module loaded from a database).
606
+ ``__file__ `` is optional (if set, value must be a string). It indicates
607
+ the pathname of the file from which the module was loaded (if
608
+ loaded from a file), or the pathname of the shared libray file
609
+ for extension modules loaded dynamically from a shared library.
610
+ It might be missing for certain types of modules, such as C
611
+ modules that are statically linked into the interpreter, and the
612
+ import system may opt to leave it unset if it has no semantic
613
+ meaning (e.g. a module loaded from a database).
609
614
610
615
If ``__file__ `` is set, it may also be appropriate to set the
611
616
``__cached__ `` attribute which is the path to any compiled version of
Original file line number Diff line number Diff line change
1
+ The description for __file__ fixed.
2
+ Patch by Furkan Onder
You can’t perform that action at this time.
0 commit comments