classification
Title: Update PyImport_ImportFrozenModuleObject() to set __package__
Type: behavior Stage: needs patch
Components: Interpreter Core Versions: Python 3.4
process
Status: open Resolution:
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 2018-10-26 18:21 by brett.cannon.

Messages (5)
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.
History
Date User Action Args
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