bpo-36763: Add _PyCoreConfig._config_version (GH-13065) · python/cpython@373893c

Original file line numberDiff line numberDiff line change

@@ -65,7 +65,12 @@ typedef struct {

6565
6666

/* --- _PyPreConfig ----------------------------------------------- */

6767
68+

#define _Py_CONFIG_VERSION 1

69+
6870

typedef struct {

71+

int _config_version; /* Internal configuration version,

72+

used for ABI compatibility */

73+
6974

/* If greater than 0, enable isolated mode: sys.path contains

7075

neither the script's directory nor the user's site-packages directory.

7176

@@ -132,6 +137,7 @@ typedef struct {

132137

#define _PyPreConfig_INIT \

133138

(_PyPreConfig){ \

134139

_PyPreConfig_WINDOWS_INIT \

140+

._config_version = _Py_CONFIG_VERSION, \

135141

.isolated = -1, \

136142

.use_environment = -1, \

137143

.dev_mode = -1, \

@@ -141,9 +147,12 @@ typedef struct {

141147

/* --- _PyCoreConfig ---------------------------------------------- */

142148
143149

typedef struct {

144-

int isolated;

145-

int use_environment;

146-

int dev_mode;

150+

int _config_version; /* Internal configuration version,

151+

used for ABI compatibility */

152+
153+

int isolated; /* Isolated mode? see _PyPreConfig.isolated */

154+

int use_environment; /* Use environment variables? see _PyPreConfig.use_environment */

155+

int dev_mode; /* Development mode? See _PyPreConfig.dev_mode */

147156
148157

/* Install signal handlers? Yes by default. */

149158

int install_signal_handlers;

@@ -397,6 +406,7 @@ typedef struct {

397406

#define _PyCoreConfig_INIT \

398407

(_PyCoreConfig){ \

399408

_PyCoreConfig_WINDOWS_INIT \

409+

._config_version = _Py_CONFIG_VERSION, \

400410

.isolated = -1, \

401411

.use_environment = -1, \

402412

.dev_mode = -1, \