Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4bca95

Browse files
authored
bpo-32030: Add _PyCoreConfig.argv (#4934)
* Add argc and argv to _PyCoreConfig * _PyMainInterpreterConfig_Read() now builds its argv from _PyCoreConfig.arg * Move _PyMain.env_warning_options into _Py_CommandLineDetails * Reorder pymain_free()
1 parent f4e21a2 commit c4bca95

3 files changed

Lines changed: 233 additions & 151 deletions

File tree

Include/pylifecycle.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ PyAPI_FUNC(int) _PyCoreConfig_Copy(
6161
_PyCoreConfig *config,
6262
const _PyCoreConfig *config2);
6363

64-
PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_Read(_PyMainInterpreterConfig *, _PyCoreConfig *);
64+
PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_Read(
65+
_PyMainInterpreterConfig *config,
66+
const _PyCoreConfig *core_config);
6567
PyAPI_FUNC(void) _PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *);
6668
PyAPI_FUNC(int) _PyMainInterpreterConfig_Copy(
6769
_PyMainInterpreterConfig *config,

Include/pystate.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,18 @@ typedef struct {
4747
wchar_t *home; /* PYTHONHOME environment variable,
4848
see also Py_SetPythonHome(). */
4949
wchar_t *program_name; /* Program name, see also Py_GetProgramName() */
50+
51+
int argc; /* Number of command line arguments,
52+
-1 means unset */
53+
wchar_t **argv; /* sys.argv, ignored if argc is negative */
5054
} _PyCoreConfig;
5155

5256
#define _PyCoreConfig_INIT \
53-
(_PyCoreConfig){.use_hash_seed = -1, .coerce_c_locale = -1, .utf8_mode = -1}
57+
(_PyCoreConfig){ \
58+
.use_hash_seed = -1, \
59+
.coerce_c_locale = -1, \
60+
.utf8_mode = -1, \
61+
.argc = -1}
5462
/* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */
5563

5664
/* Placeholders while working on the new configuration API

0 commit comments

Comments
 (0)