Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue18698

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:importlib.reload() does not return the module in sys.modules
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.3, Python 3.4
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: eric.snowNosy List: brett.cannon, eric.snow, python-dev
Priority:normalKeywords:patch

Created on2013-08-09 23:27 byeric.snow, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
reload_replaced_module.differic.snow,2013-08-14 06:34
Messages (6)
msg194776 -(view)Author: Eric Snow (eric.snow)*(Python committer)Date: 2013-08-09 23:27
Currently reload() returns the module that loader.load_module() returns, rather than returning the one in sys.modules.  This is different from what happens during normal import.  I would expect reload() to return what's in sys.modules.  Perhaps this got overlooked when we moved reload()?  I haven't had a chance to verify, but I do recall that the switch to importlib-based import in 3.3 exposed a bug where importlib wasn't returning the module in sys.modules during normal import.
msg194827 -(view)Author: Brett Cannon (brett.cannon)*(Python committer)Date: 2013-08-10 20:01
I'm sure it's an oversight.
msg195125 -(view)Author: Eric Snow (eric.snow)*(Python committer)Date: 2013-08-14 06:34
Yep.  In 2.7 and 3.2 the PyImport_ExecCodeModuleEx() function inPython/importlib.c returns the module found in sys.modules.  Here is a patch.  I suppose this should be fixed in 2.7 as well.  Thoughts?
msg195177 -(view)Author: Brett Cannon (brett.cannon)*(Python committer)Date: 2013-08-14 15:11
I think you mean in 3.3 and yes. =) Patch LGTM so I say fix in 3.3 and merge into default.
msg195229 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2013-08-15 00:18
New changesete22e7268e58a by Eric Snow in branch '3.3':issue#18698: ensure importlib.reload() returns the module out of sys.modules.http://hg.python.org/cpython/rev/e22e7268e58aNew changeset1af087712e69 by Eric Snow in branch 'default':Closes issue#18698: ensure importlib.reload() returns the module out of sys.modules.http://hg.python.org/cpython/rev/1af087712e69
msg195230 -(view)Author: Eric Snow (eric.snow)*(Python committer)Date: 2013-08-15 00:23
oops.  That commit message for 3.3 should have read "imp.reload()". :)
History
DateUserActionArgs
2022-04-11 14:57:49adminsetgithub: 62898
2013-08-15 00:23:16eric.snowsetstatus: open -> closed
resolution: fixed
messages: +msg195230

stage: patch review -> resolved
2013-08-15 00:18:33python-devsetnosy: +python-dev
messages: +msg195229
2013-08-14 15:11:04brett.cannonsetassignee:eric.snow
messages: +msg195177
2013-08-14 06:34:20eric.snowsetfiles: +reload_replaced_module.diff
keywords: +patch
messages: +msg195125

stage: patch review
2013-08-10 20:01:14brett.cannonsetmessages: +msg194827
2013-08-09 23:27:18eric.snowcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp