[New-bugs-announce] [issue12598] Move sys variable initialization from import.c to sysmodule.c

Eric Snow report at bugs.python.org
Thu Jul 21 01:24:44 CEST 2011


New submission from Eric Snow <ericsnowcurrently at gmail.com>:

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.

----------
files: sys_import_state.diff
keywords: patch
messages: 140769
nosy: ericsnow
priority: normal
severity: normal
status: open
title: Move sys variable initialization from import.c to sysmodule.c
Added file: http://bugs.python.org/file22707/sys_import_state.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12598>
_______________________________________


More information about the New-bugs-announce mailing list