This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients lukasz.langa, vstinner
Date 2019-09-28.00:32:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.


   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

   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:45vstinnersetrecipients: + vstinner, lukasz.langa
2019-09-28 00:32:45vstinnersetmessageid: <>
2019-09-28 00:32:44vstinnerlinkissue38304 messages
2019-09-28 00:32:44vstinnercreate