bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)
* Rename PyConfig.use_peg to _use_peg_parser
* Document PyConfig._use_peg_parser and mark it a deprecated
* Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated
in the documentation.
* Add use_old_parser() and skip_if_new_parser() to test.support
* Remove sys.flags.use_peg: use_old_parser() uses
_testinternalcapi.get_configs() instead.
* Enhance test_embed tests
* subprocess._args_from_interpreter_flags() copies -X oldparser
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 6199f0c..e3fd3b2 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -185,7 +185,7 @@
PyArena *arena;
const char *ps1 = "", *ps2 = "", *enc = NULL;
int errcode = 0;
- int use_peg = _PyInterpreterState_GET()->config.use_peg;
+ int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
_Py_IDENTIFIER(encoding);
_Py_IDENTIFIER(__main__);
@@ -1030,7 +1030,7 @@
mod_ty mod;
PyArena *arena;
PyObject *filename;
- int use_peg = _PyInterpreterState_GET()->config.use_peg;
+ int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
filename = _PyUnicode_FromId(&PyId_string); /* borrowed */
if (filename == NULL)
@@ -1061,7 +1061,7 @@
mod_ty mod;
PyArena *arena = NULL;
PyObject *filename;
- int use_peg = _PyInterpreterState_GET()->config.use_peg;
+ int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
filename = PyUnicode_DecodeFSDefault(filename_str);
if (filename == NULL)
@@ -1222,7 +1222,7 @@
{
PyCodeObject *co;
mod_ty mod;
- int use_peg = _PyInterpreterState_GET()->config.use_peg;
+ int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
PyArena *arena = PyArena_New();
if (arena == NULL)
return NULL;
@@ -1329,7 +1329,7 @@
{
struct symtable *st;
mod_ty mod;
- int use_peg = _PyInterpreterState_GET()->config.use_peg;
+ int use_peg = _PyInterpreterState_GET()->config._use_peg_parser;
PyArena *arena;
arena = PyArena_New();