New submission from Eric Snow <ericsnowcurren...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12598>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to