mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-111201: A new Python REPL (GH-111567)
Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
40cc809902
commit
f27f8c790a
41 changed files with 5328 additions and 170 deletions
|
@ -513,8 +513,13 @@ pymain_run_stdin(PyConfig *config)
|
|||
return pymain_exit_err_print();
|
||||
}
|
||||
|
||||
PyCompilerFlags cf = _PyCompilerFlags_INIT;
|
||||
int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf);
|
||||
if (!isatty(fileno(stdin))
|
||||
|| _Py_GetEnv(config->use_environment, "PYTHON_BASIC_REPL")) {
|
||||
PyCompilerFlags cf = _PyCompilerFlags_INIT;
|
||||
int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf);
|
||||
return (run != 0);
|
||||
}
|
||||
int run = pymain_run_module(L"_pyrepl", 0);
|
||||
return (run != 0);
|
||||
}
|
||||
|
||||
|
@ -537,9 +542,15 @@ pymain_repl(PyConfig *config, int *exitcode)
|
|||
return;
|
||||
}
|
||||
|
||||
PyCompilerFlags cf = _PyCompilerFlags_INIT;
|
||||
int res = PyRun_AnyFileFlags(stdin, "<stdin>", &cf);
|
||||
*exitcode = (res != 0);
|
||||
if (!isatty(fileno(stdin))) {
|
||||
PyCompilerFlags cf = _PyCompilerFlags_INIT;
|
||||
int run = PyRun_AnyFileExFlags(stdin, "<stdin>", 0, &cf);
|
||||
*exitcode = (run != 0);
|
||||
return;
|
||||
}
|
||||
int run = pymain_run_module(L"_pyrepl", 0);
|
||||
*exitcode = (run != 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue