Issue 18114: Update PyImport_ImportFrozenModuleObject() to set package (original) (raw)

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".
History
Date User Action Args
2022-04-11 14:57:46 admin set github: 62314
2020-03-06 20🔞13 brett.cannon set status: open -> closedresolution: wont fixmessages: + stage: needs patch -> resolved
2018-10-26 18:21:23 brett.cannon set messages: +
2018-10-12 05:05:48 andreip set nosy: + andreipmessages: +
2013-06-10 23:24:46 brett.cannon set keywords: + easymessages: +
2013-06-10 23:24:31 brett.cannon set priority: normal -> lowassignee: brett.cannon -> messages: + title: Update PyImport_ImportFrozenModuleObject() to use importlib -> Update PyImport_ImportFrozenModuleObject() to set __package__
2013-06-01 03:13:19 brett.cannon create