bpo-38304: Remove PyConfig.struct_size (GH-16500)
For now, we'll rely on the fact that the config structures aren't covered by the stable ABI.
We may revisit this in the future if we further explore the idea of offering a stable embedding API.
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index 4c77d5d..15b8b94 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -194,25 +194,18 @@
* Configure the LC_CTYPE locale
* Set the UTF-8 mode
- The :c:member:`struct_size` field must be explicitly initialized to
- ``sizeof(PyPreConfig)``.
-
Function to initialize a preconfiguration:
- .. c:function:: PyStatus PyPreConfig_InitIsolatedConfig(PyPreConfig *preconfig)
+ .. c:function:: void PyPreConfig_InitIsolatedConfig(PyPreConfig *preconfig)
Initialize the preconfiguration with :ref:`Python Configuration
<init-python-config>`.
- .. c:function:: PyStatus PyPreConfig_InitPythonConfig(PyPreConfig *preconfig)
+ .. c:function:: void PyPreConfig_InitPythonConfig(PyPreConfig *preconfig)
Initialize the preconfiguration with :ref:`Isolated Configuration
<init-isolated-conf>`.
- The caller of these functions is responsible to handle exceptions (error or
- exit) using :c:func:`PyStatus_Exception` and
- :c:func:`Py_ExitStatusException`.
-
Structure fields:
.. c:member:: int allocator
@@ -274,13 +267,6 @@
same way the regular Python parses command line arguments: see
:ref:`Command Line Arguments <using-on-cmdline>`.
- .. c:member:: size_t struct_size
-
- Size of the structure in bytes: must be initialized to
- ``sizeof(PyPreConfig)``.
-
- Field used for API and ABI compatibility.
-
.. c:member:: int use_environment
See :c:member:`PyConfig.use_environment`.
@@ -332,12 +318,7 @@
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;
@@ -360,9 +341,6 @@
Structure containing most parameters to configure Python.
- The :c:member:`struct_size` field must be explicitly initialized to
- ``sizeof(PyConfig)``.
-
Structure methods:
.. c:function:: PyStatus PyConfig_InitPythonConfig(PyConfig *config)
@@ -679,13 +657,6 @@
Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and
:data:`sys.stderr`.
- .. c:member:: size_t struct_size
-
- Size of the structure in bytes: must be initialized to
- ``sizeof(PyConfig)``.
-
- Field used for API and ABI compatibility.
-
.. c:member:: int tracemalloc
If non-zero, call :func:`tracemalloc.start` at startup.
@@ -754,7 +725,6 @@
{
PyStatus status;
PyConfig config;
- config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@@ -787,7 +757,6 @@
{
PyStatus status;
PyConfig config;
- config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@@ -875,7 +844,6 @@
{
PyStatus status;
PyConfig config;
- config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {
@@ -1067,7 +1035,6 @@
{
PyStatus status;
PyConfig config;
- config.struct_size = sizeof(PyConfig);
status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) {