[issue21762] update the import machinery to only use __spec__

2022-02-04 Thread Brett Cannon
Brett Cannon added the comment: Dumping my personal notes here as backup and in case anyone else wants to know how this is going. 1. `__package__` - [x] Make sure all uses of the attribute fall back on `__spec__` (done way back when) - [x] Add an `ImportWarning` when the

[issue21762] update the import machinery to only use __spec__

2022-02-04 Thread Brett Cannon
Change by Brett Cannon : -- dependencies: +Use specs instead of just __loader__ in C code ___ Python tracker ___ ___

[issue21762] update the import machinery to only use __spec__

2021-12-07 Thread Brett Cannon
Change by Brett Cannon : -- assignee: -> brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21762] update the import machinery to only use __spec__

2020-10-23 Thread Brett Cannon
Brett Cannon added the comment: It turns out that the import system itself doesn't use `__loader__` (it does set it), but various parts of the stdlib do use `__loader__`. bpo-42133 updates a bunch of stdlib modules to use `__spec__.loader` as a fallback. bpo-42132 tracks the fact that

[issue21762] update the import machinery to only use __spec__

2019-08-07 Thread Joannah Nanjekye
Change by Joannah Nanjekye : -- nosy: +nanjekyejoannah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21762] update the import machinery to only use __spec__

2017-12-13 Thread Barry A. Warsaw
Change by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list

[issue21762] update the import machinery to only use __spec__

2016-01-22 Thread Brett Cannon
Brett Cannon added the comment: I think that leaves the following attributes to be updated/checked for dependencies in importlib (and if they are found, raise ImportWarning when they differ): 1. __path__ 2. __loader__ 3. __file__ 4. __cached__ --

[issue21762] update the import machinery to only use __spec__

2016-01-16 Thread Nick Coghlan
Nick Coghlan added the comment: That approach sounds good to me. The main problem cases I'm aware of are: __name__: * reliably wrong in __main__ * the attribute you mess with if you want __qualname__ on functions and classes to be different so that pickle will import them from somewhere else

[issue21762] update the import machinery to only use __spec__

2016-01-16 Thread Brett Cannon
Brett Cannon added the comment: I totally agree proper notes in the What's New doc need to be in place to explain that people need to update. How about I tweak the __package__ change to continue to prefer __package__ over __spec__.parent, but raise an ImportWarning when they differ? It can

[issue21762] update the import machinery to only use __spec__

2016-01-16 Thread Brett Cannon
Brett Cannon added the comment: Yeah, which is why it will take a transition to get people to start mucking with __spec__ instead of the module attributes for their legitimate/questionable needs (although the whole `__name__ == '__main__'` idiom means __name__ will never go away while

[issue21762] update the import machinery to only use __spec__

2016-01-15 Thread Brett Cannon
Brett Cannon added the comment: So I am going to disagree with Nick about the module attributes and their usefulness (partially because I just made __spec__.parent take precedence over __package__ in issue #25791). While I get the idea of wanting a history of what did (not) change since

[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Eric Snow
New submission from Eric Snow: With PEP 451, Python 3.4 introduced module specs to encapsulate the module's import-related information, particularly for loading. While __loader__, __file__, and __cached__ are no longer used by the import machinery, in a few places it still uses __name__,

[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Nick Coghlan
Nick Coghlan added the comment: Manipulating name, package and path at runtime is fully supported, and the module level attributes accordingly take precedence over the initial import time spec. There may be some test suite gaps and documentation issues around the behaviour, but it's definitely

[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Eric Snow
Eric Snow added the comment: Thanks for clarifying. I remembered discussing it but couldn't recall the details. Documenting the exact semantics, use cases, and difference between spec and module attrs would be help. I'll look into updating the language reference when I have some time. It

[issue21762] update the import machinery to only use __spec__

2014-06-14 Thread Nick Coghlan
Nick Coghlan added the comment: The spec is authoritative for how was this imported?. The differences between that and the module attributes then provide a record of any post-import modifications. -- ___ Python tracker rep...@bugs.python.org