homepage

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
Title: Move sys variable initialization from import.c to sysmodule.c
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: benjamin.peterson, eric.snow, ncoghlan, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2011年07月20日 23:24 by eric.snow, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sys_import_state.diff eric.snow, 2011年07月20日 23:24 review
Messages (6)
msg140769 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2011年07月20日 23:24
Several import-related sys variables are set in _PyImportHooks_Init (in Python/import.c), which is called in Python/pythonrun.c. I have included a patch that moves that initialization from _PyImportHooks_Init to a new _SysImportState_Init function in Python/sysmodule.c, which is then called from _PyImportHooks_Init.
This may seem like an unnecessary change, but sysmodule.c is the obvious place to find the initialization of sys variables. Other than in pythonrun.c, import.c is the only place that sys variables are set outside of sysmodule.c.
Finally, several import related projects[1] are coming up that will impact import.c and _PyImportHooks_Init specifically. This change helps clean up import.c a little in preparation for those projects, and isolates out of import.c at least one thing that should be kept safe during any import.c refactoring.
[1] see issue #2377, PEP 402, and the GSOC import engine project.
msg158637 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012年04月18日 16:32
The patch is out of date, but the question is still somewhat applicable.
msg158650 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年04月18日 19:17
This looks sensible.
msg158653 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012年04月18日 19:33
I don't see the point.
msg158670 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2012年04月18日 22:06
It's about navigability/discovery of the source - to find out how the sys module gets initialised, you currently have to look in multiple places. The idea of the patch is to simplify that to the one logical place: sysmodule.c
However, I'm not sure it's right to actually *move* the full import state initialisation. A simple *indirection* (pythonrun.c -> sysmodule.c -> import.c) would solve the navigability problem while also retaining some level of encapsulation for the import state initialisation.
msg355164 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019年10月22日 22:42
No activity for 7 years, I close the issue.
History
Date User Action Args
2022年04月11日 14:57:19adminsetgithub: 56807
2019年10月22日 22:42:39vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg355164

resolution: out of date
stage: resolved
2013年06月25日 05:29:25eric.snowsetassignee: eric.snow
2013年02月01日 22:28:58brett.cannonsetnosy: - brett.cannon
2012年04月18日 22:06:27ncoghlansetmessages: + msg158670
2012年04月18日 19:33:54benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg158653
2012年04月18日 19:17:08pitrousetnosy: + pitrou
messages: + msg158650
components: + Interpreter Core
2012年04月18日 16:32:28eric.snowsetmessages: + msg158637
versions: + Python 3.3
2011年07月20日 23:29:47ncoghlansetnosy: + brett.cannon, ncoghlan
2011年07月20日 23:24:44eric.snowcreate

AltStyle によって変換されたページ (->オリジナル) /