Message353430
The current implementation of the PEP 587 is not ready for future evolutions of the PyPreConfig and PyConfig structure. Any change will break the ABI compatibility. Their _config_version field is useless.
The first versions of the PEP 587 used a macro to statically initialize the structure. It was decided to get ride of macros to use functions instead.
Example:
PyConfig config;
PyStatus status = PyConfig_InitPythonConfig(&config);
PyConfig_InitPythonConfig() gets unitialized memory and doesn't know the size of the config variable.
I propose to require to store the size of the structure in the structure directly:
* Add PyPreConfig.struct_size and PyConfig.struct_size
* Require to initialize these fields to sizeof(PyPreConfig) and sizeof(PyConfig) respectively
Example:
PyConfig config;
config.struct_size = sizeof(PyConfig);
PyStatus status = PyConfig_InitPythonConfig(&config);
Thanks to the struct_size field, PyConfig_InitPythonConfig() can support old PyConfig structures without breaking the ABI.
If an old PyConfig is passed to PyConfig_Read(): newer fields will be ignored. |
|
Date |
User |
Action |
Args |
2019-09-28 00:32:45 | vstinner | set | recipients:
+ vstinner, lukasz.langa |
2019-09-28 00:32:45 | vstinner | set | messageid: <1569630765.03.0.323163871576.issue38304@roundup.psfhosted.org> |
2019-09-28 00:32:44 | vstinner | link | issue38304 messages |
2019-09-28 00:32:44 | vstinner | create | |
|