New submission from STINNER Victor <vstin...@python.org>:

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.

----------
components: Interpreter Core
messages: 353430
nosy: lukasz.langa, vstinner
priority: release blocker
severity: normal
status: open
title: PEP 587 implementation is not ABI forward compatible
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38304>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to