Updates based on implementation progress

This commit is contained in:
Nick Coghlan 2013-01-13 00:48:28 +10:00
parent 841f5a673f
commit 62c62e8b65
1 changed files with 24 additions and 4 deletions

View File

@ -177,6 +177,8 @@ be able to control the following aspects of the final interpreter state:
* Whether or not to use randomised hashes (and if used, potentially specify
a specific random seed)
* Whether or not to enable the import system (required by CPython's
build process when freezing the importlib._bootstrap bytecode)
* The "Where is Python located?" elements in the ``sys`` module:
* ``sys.executable``
* ``sys.base_exec_prefix``
@ -406,6 +408,7 @@ Other configuration settings
TBD: Cover the initialization of the following in more detail:
* Completely disabling the import system
* The initial warning system state:
* ``sys.warnoptions``
* (-W option, PYTHONWARNINGS)
@ -612,9 +615,10 @@ configuration::
int ignore_environment; /* -E switch */
int use_hash_seed; /* PYTHONHASHSEED */
unsigned long hash_seed; /* PYTHONHASHSEED */
int _disable_importlib; /* Needed by freeze_importlib */
} Py_CoreConfig;
#define Py_CoreConfig_INIT {0, -1, 0}
#define Py_CoreConfig_INIT {0, -1, 0, 0}
The core configuration settings pointer may be ``NULL``, in which case the
default values are ``ignore_environment = 0`` and ``use_hash_seed = -1``.
@ -661,6 +665,13 @@ the empty string or the value ``"random"``, both ``use_hash_seed`` and
``hash_seed``. On success the function will return zero. A non-zero return
value indicates an error (most likely in the conversion to an integer).
The ``_disable_importlib`` setting is used as part of the CPython build
process to create an interpreter with no import capability at all. It is
considered private to the CPython development team (hence the leading
underscore), as the only known use case is to permit compiler changes
that invalidate the previously frozen bytecode for ``importlib._bootstrap``
without breaking the build process.
The aim is to keep this initial level of configuration as small as possible
in order to keep the bootstrapping environment consistent across
different embedding applications. If we can create a valid interpreter state
@ -1046,8 +1057,17 @@ Open Questions
Implementation
==============
None as yet. Once I have a reasonably solid plan of attack, I intend to work
on a reference implementation as a feature branch in my BitBucket sandbox [2_]
The reference implementation is being developed as a feature branch in my
BitBucket sandbox [2_].
As the number of application binaries created by the build process is now
four, the reference implementation also creates a new top level "Apps"
directory in the CPython source tree. The source files for the main
``python`` binary and the new ``pysystem`` binary will be located in that
directory. The source files for the ``_freeze_importlib`` binary and the
``_testembed`` binary have been moved out of the Modules directory (which
is intended for CPython builtin and extension modules) and into the Tools
directory.
References
@ -1057,7 +1077,7 @@ References
(http://wiki.python.org/moin/CPythonInterpreterInitialization)
.. [2] BitBucket Sandbox
(https://bitbucket.org/ncoghlan/cpython_sandbox)
(https://bitbucket.org/ncoghlan/cpython_sandbox/compare/pep432_modular_bootstrap..default#commits)
.. [3] \*nix getpath implementation
(http://hg.python.org/cpython/file/default/Modules/getpath.c)