New submission from Eric Snow:

The language reference [1] says:

  Ultimately, the loader is what makes use of __file__ and/or __cached__

This implies that loaders should use __file__ and __cached__ when loading a 
module.  Instead loaders are meant to implement exec_module() and use the spec 
that's passed in.

The entire section should have a clear note that loaders are not meant to rely 
a module's import-related attributes.

[1] https://docs.python.org/3/reference/import.html#__file__
[2] 
https://docs.python.org/3/reference/import.html#import-related-module-attributes

----------
messages: 220578
nosy: barry, brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: language reference describes the role of module.__file__ inaccurately
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to