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.

Title: Update PyImport_ImportFrozenModuleObject() to set __package__
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.4
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: andreip, brett.cannon
Priority: low Keywords: easy

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

Messages (6)
msg190434 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-01 03:13
_imp.init_frozen is not really necessary; you can implement imports entirely using the other frozen-related functions. Because of that it's probably better to simply rewrite PyImport_ImportFrozenModuleObject() to use importlib to make the code easier to maintain and help guarantee consistency with other code.
msg190938 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-10 23:24
Forgot that PyImport_ImportFrozenModule() uses PyImport_ImportFrozenModuleObject() and the former is used to load _frozen_importlib, so can't drop the function. The code could still be updated, though, to set __package__ before the code object is executed. That probably wouldn't be too hard to do by factoring out the code in PyImport_ImportModuleLevelObject which calculates the parent there.
msg190939 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-06-10 23:24
Marking as easy for any C coders.
msg327561 - (view) Author: Andrei Petre (andreip) * Date: 2018-10-12 05:05
Hi, is this still relevant? I see the file has changed quite a bit.
msg328583 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2018-10-26 18:21
I'm not sure if it's still relevant. :) Feel free to look at the code and come back here with a recommendation as to whether this is still necessary or not.
msg363541 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-03-06 20:18
Since there's work to drop __package__, closing as "won't fix".
Date User Action Args
2022-04-11 14:57:46adminsetgithub: 62314
2020-03-06 20:18:13brett.cannonsetstatus: open -> closed
resolution: wont fix
messages: + msg363541

stage: needs patch -> resolved
2018-10-26 18:21:23brett.cannonsetmessages: + msg328583
2018-10-12 05:05:48andreipsetnosy: + andreip
messages: + msg327561
2013-06-10 23:24:46brett.cannonsetkeywords: + easy

messages: + msg190939
2013-06-10 23:24:31brett.cannonsetpriority: normal -> low
assignee: brett.cannon ->
messages: + msg190938

title: Update PyImport_ImportFrozenModuleObject() to use importlib -> Update PyImport_ImportFrozenModuleObject() to set __package__
2013-06-01 03:13:19brett.cannoncreate