This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Move imp.get_magic() to importlib
类型: Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: brett.cannon 抄送列表: Arfrever, barry, brett.cannon, python-dev
优先级: normal 关键字:

Created on 2013-06-11 20:44 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (10)
msg190981 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) 日期: 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) 日期: 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) 日期: 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) 日期: 2013-06-11 21:08
I'd like to see it be more easily accessible.
msg191039 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) 日期: 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) 日期: 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) 日期: 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) 日期: 2013-06-14 19:53
I'll put it into importlib.util.MAGIC.
msg191150 - (view) Author: Barry A. Warsaw (barry) * (Python committer) 日期: 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) (Python triager) 日期: 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
历史
日期 用户 动作 参数
2022-04-11 14:57:46admin修改github: 62392
2013-06-14 23:03:12brett.cannon修改状态: open -> closed
resolution: fixed
stage: test needed -> resolved
2013-06-14 23:02:42python-dev修改抄送: + python-dev
消息: + msg191167
2013-06-14 22:36:40brett.cannon修改assignee: barry -> brett.cannon
2013-06-14 20:14:18barry修改消息: + msg191150
2013-06-14 19:53:38brett.cannon修改消息: + msg191149
2013-06-14 19:35:25barry修改消息: + msg191148
2013-06-14 19:08:56brett.cannon修改assignee: barry
2013-06-14 19:08:47brett.cannon修改消息: + msg191146
2013-06-12 17:41:00brett.cannon修改消息: + msg191039
2013-06-11 22:05:51Arfrever修改抄送: + Arfrever
2013-06-11 21:08:05barry修改消息: + msg190988
2013-06-11 21:07:31barry修改抄送: + barry
消息: + msg190987
2013-06-11 20:52:45brett.cannon修改消息: + msg190985
2013-06-11 20:44:21brett.cannon链接issue17177 dependencies
2013-06-11 20:44:04brett.cannon创建