Message407885
| Author |
eric.snow |
| Recipients |
barry, brett.cannon, docs@python, eric.snow, iritkatriel, ncoghlan |
| Date |
2021年12月07日.00:49:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1638838199.42.0.482004254962.issue21761@roundup.psfhosted.org> |
| In-reply-to |
| Content |
The key point is that loaders should be using the spec, not any of the module attrs (like `__file__` and `__cached__`), nor setting them.
For the specific paragraph I referenced, it would look more like:
It is also appropriate to set __cached__ when __file__ is not set.
However, that scenario is quite atypical. Ultimately, __file__ and
__cached__ are set by the import system from the module spec provided
by the finder. The spec instructs the loader. If a loader can load
from a cached module but otherwise does not load from a file, that
atypical scenario may be appropriate. |
|