classification
Title: Move imp.get_magic() to importlib
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: Arfrever, barry, brett.cannon, python-dev
Priority: normal Keywords:

Created on 2013-06-11 20:44 by brett.cannon, last changed 2013-06-14 23:03 by brett.cannon. This issue is now closed.

Messages (10)
msg190981 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-11 20:44
As part of deprecating imp, need to move imp.get_magic() to importlib where it now belongs. Will be exposed as an attribute instead of a function, though.
msg190985 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-11 20:52
This could be an attribute on importlib.machinery.SourceLoader instead of an attribute in importlib.util.
msg190987 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-06-11 21:07
On Jun 11, 2013, at 08:44 PM, Brett Cannon wrote:

>As part of deprecating imp, need to move imp.get_magic() to importlib where
>it now belongs. Will be exposed as an attribute instead of a function,
>though.

so, importlib.magic ?
msg190988 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-06-11 21:08
I'd like to see it be more easily accessible.
msg191039 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-12 17:41
So what are your arguments to making it more accessible? The typical user won't need to use it so I don't know if it really requires being off of importlib directly like find_loader, import_module, or (eventually) reload (which for convenience-sake while at the interpreter should be there).

While I'm happy to entertain the argument that it should be importlib.machinery.MAGIC (like the file suffixes for the various file types) instead of importlib.abc.SourceLoader.magic, I don't want to make it importlib.magic.
msg191146 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-14 19:08
Any chance I could get a response to my questions, Barry, soon? I think I can finish the rest of the issues related to deprecating imp this weekend if we can settle this quickly.
msg191148 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-06-14 19:35
The only argument I have about it is that if someone *does* want to use, it should be fairly easily discoverable.  Also, since it's a concrete value, it seems a little weird that it's stashed in an abc.

I suppose importlib.machinery.MAGIC is better than importlib.abc.SourceLoader.magic
msg191149 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-14 19:53
I'll put it into importlib.util.MAGIC.
msg191150 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-06-14 20:14
On Jun 14, 2013, at 07:53 PM, Brett Cannon wrote:

>I'll put it into importlib.util.MAGIC.

+1
msg191167 - (view) Author: Roundup Robot (python-dev) Date: 2013-06-14 23:02
New changeset 5619bc2d8207 by Brett Cannon in branch 'default':
Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document the
http://hg.python.org/cpython/rev/5619bc2d8207
History
Date User Action Args
2013-06-14 23:03:12brett.cannonsetstatus: open -> closed
resolution: fixed
stage: test needed -> resolved
2013-06-14 23:02:42python-devsetnosy: + python-dev
messages: + msg191167
2013-06-14 22:36:40brett.cannonsetassignee: barry -> brett.cannon
2013-06-14 20:14:18barrysetmessages: + msg191150
2013-06-14 19:53:38brett.cannonsetmessages: + msg191149
2013-06-14 19:35:25barrysetmessages: + msg191148
2013-06-14 19:08:56brett.cannonsetassignee: barry
2013-06-14 19:08:47brett.cannonsetmessages: + msg191146
2013-06-12 17:41:00brett.cannonsetmessages: + msg191039
2013-06-11 22:05:51Arfreversetnosy: + Arfrever
2013-06-11 21:08:05barrysetmessages: + msg190988
2013-06-11 21:07:31barrysetnosy: + barry
messages: + msg190987
2013-06-11 20:52:45brett.cannonsetmessages: + msg190985
2013-06-11 20:44:21brett.cannonlinkissue17177 dependencies
2013-06-11 20:44:04brett.cannoncreate