PEP 587: Remove struct_size (#1185)

This commit is contained in:
Victor Stinner 2019-10-01 00:39:34 +02:00 committed by Nick Coghlan
parent b1f8c71951
commit 5c8b380387
1 changed files with 1 additions and 21 deletions

View File

@ -239,19 +239,12 @@ The ``PyPreConfig`` structure is used to preinitialize Python:
* Configure the LC_CTYPE locale
* Set the UTF-8 mode
The ``struct_size`` field must be explicitly initialized to
``sizeof(PyPreConfig)``.
Example using the preinitialization to enable the UTF-8 Mode::
PyStatus status;
PyPreConfig preconfig;
preconfig.struct_size = sizeof(PyPreConfig);
status = PyPreConfig_InitPythonConfig(&preconfig);
if (PyStatus_Exception(status)) {
Py_ExitStatusException(status);
}
PyPreConfig_InitPythonConfig(&preconfig);
preconfig.utf8_mode = 1;
@ -327,9 +320,6 @@ an effect on the pre-configuration like encodings. For example, the
``Py_PreInitializeFromBytesArgs()`` parse their ``argv`` argument the
same way the regular Python parses command line arguments: see
`Command Line Arguments`_.
* ``struct_size`` (``size_t``:
Size of the structure in bytes: must be initialized to
``sizeof(PyPreConfig)``. Field used for API and ABI compatibility.
* ``use_environment`` (``int``):
See ``PyConfig.use_environment``.
* ``utf8_mode`` (``int``):
@ -359,16 +349,12 @@ Initialization with PyConfig
The ``PyConfig`` structure contains most parameters to configure Python.
The ``struct_size`` field must be explicitly initialized to
``sizeof(PyConfig)``.
Example setting the program name::
void init_python(void)
{
PyStatus status;
PyConfig config;
config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@ -571,9 +557,6 @@ exceptions (error or exit) using ``PyStatus_Exception()`` and
``stdio_errors`` (``wchar_t*``):
Encoding and encoding errors of ``sys.stdin``, ``sys.stdout``
and ``sys.stderr``.
* ``struct_size`` (``size_t``:
Size of the structure in bytes: must be initialized to
``sizeof(PyConfig)``. Field used for API and ABI compatibility.
* ``tracemalloc`` (``int``):
If non-zero, call ``tracemalloc.start(value)``.
* ``user_site_directory`` (``int``):
@ -614,7 +597,6 @@ configuration, and then override some parameters::
{
PyStatus status;
PyConfig config;
config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@ -703,7 +685,6 @@ Example of customized Python always running in isolated mode::
{
PyStatus status;
PyConfig config;
config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@ -879,7 +860,6 @@ phases::
{
PyStatus status;
PyConfig config;
config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {