mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
This commit is contained in:
parent
a25f3c4c8f
commit
1def7754b7
26 changed files with 83 additions and 54 deletions
|
@ -4,12 +4,12 @@
|
|||
"""
|
||||
import sys
|
||||
import unittest
|
||||
from test.support import is_jython
|
||||
from test import support
|
||||
|
||||
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
|
||||
import io
|
||||
|
||||
if is_jython:
|
||||
if support.is_jython:
|
||||
|
||||
def unify_callables(d):
|
||||
for n,v in d.items():
|
||||
|
@ -21,7 +21,7 @@ class CodeopTests(unittest.TestCase):
|
|||
|
||||
def assertValid(self, str, symbol='single'):
|
||||
'''succeed iff str is a valid piece of code'''
|
||||
if is_jython:
|
||||
if support.is_jython:
|
||||
code = compile_command(str, "<input>", symbol)
|
||||
self.assertTrue(code)
|
||||
if symbol == "single":
|
||||
|
@ -60,7 +60,7 @@ class CodeopTests(unittest.TestCase):
|
|||
av = self.assertValid
|
||||
|
||||
# special case
|
||||
if not is_jython:
|
||||
if not support.is_jython:
|
||||
self.assertEqual(compile_command(""),
|
||||
compile("pass", "<input>", 'single',
|
||||
PyCF_DONT_IMPLY_DEDENT))
|
||||
|
@ -122,7 +122,7 @@ class CodeopTests(unittest.TestCase):
|
|||
av("def f():\n pass\n#foo\n")
|
||||
av("@a.b.c\ndef f():\n pass\n")
|
||||
|
||||
@unittest.skipIf(sys.flags.use_peg, "Pegen does not support PyCF_DONT_INPLY_DEDENT yet")
|
||||
@support.skip_if_new_parser("Pegen does not support PyCF_DONT_INPLY_DEDENT yet")
|
||||
def test_incomplete(self):
|
||||
ai = self.assertIncomplete
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue