Unverified Kaydet (Commit) 62be7633 authored tarafından Victor Stinner's avatar Victor Stinner Kaydeden (comit) GitHub

bpo-36142: Remove _PyMain structure (GH-12120)

* Move fields from _PyMain to _PyCoreConfig:

  * skip_first_line
  * run_command
  * run_module
  * run_filename

* Replace _PyMain.stdin_is_interactive with a new
  stdin_is_interactive(config) function
* Rename _PyMain to _PyArgv. Add "const _PyArgv *args" field
  to _PyCmdline.
üst dfe88475
......@@ -276,7 +276,19 @@ typedef struct {
int legacy_windows_stdio;
#endif
/* --- Private fields -------- */
/* --- Parameter only used by Py_Main() ---------- */
/* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of
"#!cmd". This is intended for a DOS specific hack only.
Set by the -x command line option. */
int skip_source_first_line;
wchar_t *run_command; /* -c command line argument */
wchar_t *run_module; /* -m command line argument */
wchar_t *run_filename; /* Trailing command line argument without -c or -m */
/* --- Private fields ---------------------------- */
/* Install importlib? If set to 0, importlib is not initialized at all.
Needed by freeze_importlib. */
......
......@@ -322,6 +322,11 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
'stdio_encoding': GET_DEFAULT_CONFIG,
'stdio_errors': GET_DEFAULT_CONFIG,
'skip_source_first_line': 0,
'run_command': None,
'run_module': None,
'run_filename': None,
'_install_importlib': 1,
'_check_hash_pycs_mode': 'default',
'_frozen': 0,
......
This diff is collapsed.
......@@ -424,6 +424,10 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2)
COPY_ATTR(legacy_windows_fs_encoding);
COPY_ATTR(legacy_windows_stdio);
#endif
COPY_ATTR(skip_source_first_line);
COPY_WSTR_ATTR(run_command);
COPY_WSTR_ATTR(run_module);
COPY_WSTR_ATTR(run_filename);
COPY_ATTR(_check_hash_pycs_mode);
COPY_ATTR(_frozen);
......@@ -1559,6 +1563,10 @@ _PyCoreConfig_AsDict(const _PyCoreConfig *config)
SET_ITEM_INT(legacy_windows_fs_encoding);
SET_ITEM_INT(legacy_windows_stdio);
#endif
SET_ITEM_INT(skip_source_first_line);
SET_ITEM_WSTR(run_command);
SET_ITEM_WSTR(run_module);
SET_ITEM_WSTR(run_filename);
SET_ITEM_INT(_install_importlib);
SET_ITEM_STR(_check_hash_pycs_mode);
SET_ITEM_INT(_frozen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment