| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 311110a commit 1ed83ad
53 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -695,16 +695,6 @@ PyConfig | |||
| 695 | 695 | ||
| 696 | 696 | :data:`sys._xoptions`. | |
| 697 | 697 | ||
| 698 | - .. c:member:: int _use_peg_parser | ||
| 699 | - | ||
| 700 | - Enable PEG parser? Default: 1. | ||
| 701 | - | ||
| 702 | - Set to 0 by :option:`-X oldparser <-X>` and :envvar:`PYTHONOLDPARSER`. | ||
| 703 | - | ||
| 704 | - See also :pep:`617`. | ||
| 705 | - | ||
| 706 | - .. deprecated-removed:: 3.9 3.10 | ||
| 707 | - | ||
| 708 | 698 | If ``parse_argv`` is non-zero, ``argv`` arguments are parsed the same | |
| 709 | 699 | way the regular Python parses command line arguments, and Python | |
| 710 | 700 | arguments are stripped from ``argv``: see :ref:`Command Line Arguments | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -426,8 +426,6 @@ Miscellaneous options | |||
| 426 | 426 | defines the following possible values: | |
| 427 | 427 | ||
| 428 | 428 | * ``-X faulthandler`` to enable :mod:`faulthandler`; | |
| 429 | - * ``-X oldparser``: enable the traditional LL(1) parser. See also | ||
| 430 | - :envvar:`PYTHONOLDPARSER` and :pep:`617`. | ||
| 431 | 429 | * ``-X showrefcount`` to output the total reference count and number of used | |
| 432 | 430 | memory blocks when the program finishes or after each statement in the | |
| 433 | 431 | interactive interpreter. This only works on debug builds. | |
@@ -587,15 +585,6 @@ conflict. | |||
| 587 | 585 | :option:`-d` multiple times. | |
| 588 | 586 | ||
| 589 | 587 | ||
| 590 | - .. envvar:: PYTHONOLDPARSER | ||
| 591 | - | ||
| 592 | - If this is set to a non-empty string, enable the traditional LL(1) parser. | ||
| 593 | - | ||
| 594 | - See also the :option:`-X` ``oldparser`` option and :pep:`617`. | ||
| 595 | - | ||
| 596 | - .. deprecated-removed:: 3.9 3.10 | ||
| 597 | - | ||
| 598 | - | ||
| 599 | 588 | .. envvar:: PYTHONINSPECT | |
| 600 | 589 | ||
| 601 | 590 | If this is set to a non-empty string it is equivalent to specifying the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,10 +144,6 @@ typedef struct { | |||
| 144 | 144 | Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */ | |
| 145 | 145 | int faulthandler; | |
| 146 | 146 | ||
| 147 | - /* Enable PEG parser? | ||
| 148 | - 1 by default, set to 0 by -X oldparser and PYTHONOLDPARSER */ | ||
| 149 | - int _use_peg_parser; | ||
| 150 | - | ||
| 151 | 147 | /* Enable tracemalloc? | |
| 152 | 148 | Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */ | |
| 153 | 149 | int tracemalloc; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -326,7 +326,7 @@ def _args_from_interpreter_flags(): | |||
| 326 | 326 | if dev_mode: | |
| 327 | 327 | args.extend(('-X', 'dev')) | |
| 328 | 328 | for opt in ('faulthandler', 'tracemalloc', 'importtime', | |
| 329 | - 'showrefcount', 'utf8', 'oldparser'): | ||
| 329 | + 'showrefcount', 'utf8'): | ||
| 330 | 330 | if opt in xoptions: | |
| 331 | 331 | value = xoptions[opt] | |
| 332 | 332 | if value is True: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1958,13 +1958,3 @@ def wait_process(pid, *, exitcode, timeout=None): | |||
| 1958 | 1958 | # sanity check: it should not fail in practice | |
| 1959 | 1959 | if pid2 != pid: | |
| 1960 | 1960 | raise AssertionError(f"pid {pid2} != pid {pid}") | |
| 1961 | - | ||
| 1962 | - | ||
| 1963 | - def use_old_parser(): | ||
| 1964 | - import _testinternalcapi | ||
| 1965 | - config = _testinternalcapi.get_configs() | ||
| 1966 | - return (config['config']['_use_peg_parser'] == 0) | ||
| 1967 | - | ||
| 1968 | - | ||
| 1969 | - def skip_if_new_parser(msg): | ||
| 1970 | - return unittest.skipIf(not use_old_parser(), msg) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -347,7 +347,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): | |||
| 347 | 347 | 'isolated': 0, | |
| 348 | 348 | 'use_environment': 1, | |
| 349 | 349 | 'dev_mode': 0, | |
| 350 | - '_use_peg_parser': 1, | ||
| 351 | 350 | ||
| 352 | 351 | 'install_signal_handlers': 1, | |
| 353 | 352 | 'use_hash_seed': 0, | |
@@ -733,7 +732,6 @@ def test_init_from_config(self): | |||
| 733 | 732 | 'import_time': 1, | |
| 734 | 733 | 'show_ref_count': 1, | |
| 735 | 734 | 'malloc_stats': 1, | |
| 736 | - '_use_peg_parser': 0, | ||
| 737 | 735 | ||
| 738 | 736 | 'stdio_encoding': 'iso8859-1', | |
| 739 | 737 | 'stdio_errors': 'replace', | |
@@ -807,7 +805,6 @@ def test_init_compat_env(self): | |||
| 807 | 805 | 'warnoptions': ['EnvVar'], | |
| 808 | 806 | 'platlibdir': 'env_platlibdir', | |
| 809 | 807 | 'module_search_paths': self.IGNORE_CONFIG, | |
| 810 | - '_use_peg_parser': 0, | ||
| 811 | 808 | } | |
| 812 | 809 | self.check_all_configs("test_init_compat_env", config, preconfig, | |
| 813 | 810 | api=API_COMPAT) | |
@@ -837,7 +834,6 @@ def test_init_python_env(self): | |||
| 837 | 834 | 'warnoptions': ['EnvVar'], | |
| 838 | 835 | 'platlibdir': 'env_platlibdir', | |
| 839 | 836 | 'module_search_paths': self.IGNORE_CONFIG, | |
| 840 | - '_use_peg_parser': 0, | ||
| 841 | 837 | } | |
| 842 | 838 | self.check_all_configs("test_init_python_env", config, preconfig, | |
| 843 | 839 | api=API_PYTHON) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,9 +251,9 @@ def baz(): | |||
| 251 | 251 | check('def f():\n x, y: int', 2, 3) | |
| 252 | 252 | check('[*x for x in xs]', 1, 2) | |
| 253 | 253 | check('foo(x for x in range(10), 100)', 1, 5) | |
| 254 | - check('(yield i) = 2', 1, 1 if support.use_old_parser() else 2) | ||
| 255 | - check('def f(*):\n pass', 1, 7 if support.use_old_parser() else 8) | ||
| 256 | - check('for 1 in []: pass', 1, 5 if support.use_old_parser() else 7) | ||
| 254 | + check('(yield i) = 2', 1, 2) | ||
| 255 | + check('def f(*):\n pass', 1, 8) | ||
| 256 | + check('for 1 in []: pass', 1, 7) | ||
| 257 | 257 | ||
| 258 | 258 | @cpython_only | |
| 259 | 259 | def testSettingException(self): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ def test_barry_as_bdfl(self): | |||
| 20 | 20 | self.assertTrue(cm.exception.lineno, 2) | |
| 21 | 21 | # The old parser reports the end of the token and the new | |
| 22 | 22 | # parser reports the start of the token | |
| 23 | - self.assertEqual(cm.exception.offset, 4 if support.use_old_parser() else 3) | ||
| 23 | + self.assertEqual(cm.exception.offset, 3) | ||
| 24 | 24 | ||
| 25 | 25 | def test_guido_as_bdfl(self): | |
| 26 | 26 | code = '2 {0} 3' | |
@@ -33,7 +33,7 @@ def test_guido_as_bdfl(self): | |||
| 33 | 33 | self.assertEqual(cm.exception.lineno, 1) | |
| 34 | 34 | # The old parser reports the end of the token and the new | |
| 35 | 35 | # parser reports the start of the token | |
| 36 | - self.assertEqual(cm.exception.offset, 4 if support.use_old_parser() else 3) | ||
| 36 | + self.assertEqual(cm.exception.offset, 3) | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | 39 | if __name__ == '__main__': | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ | |||
| 12 | 12 | import types | |
| 13 | 13 | import decimal | |
| 14 | 14 | import unittest | |
| 15 | - from test.support import temp_cwd, use_old_parser | ||
| 15 | + from test.support import temp_cwd | ||
| 16 | 16 | from test.support.script_helper import assert_python_failure | |
| 17 | 17 | ||
| 18 | 18 | a_global = 'global variable' | |
@@ -1049,7 +1049,6 @@ def test_errors(self): | |||
| 1049 | 1049 | r"f'{1000:j}'", | |
| 1050 | 1050 | ]) | |
| 1051 | 1051 | ||
| 1052 | - @unittest.skipIf(use_old_parser(), "The old parser only supports <fstring> as the filename") | ||
| 1053 | 1052 | def test_filename_in_syntaxerror(self): | |
| 1054 | 1053 | # see issue 38964 | |
| 1055 | 1054 | with temp_cwd() as cwd: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | # Python test set -- part 1, grammar. | |
| 2 | 2 | # This just tests whether the parser accepts them all. | |
| 3 | 3 | ||
| 4 | - from test.support import check_syntax_error, check_syntax_warning, use_old_parser | ||
| 4 | + from test.support import check_syntax_error, check_syntax_warning | ||
| 5 | 5 | import inspect | |
| 6 | 6 | import unittest | |
| 7 | 7 | import sys | |
@@ -1714,69 +1714,53 @@ def __exit__(self, *args): | |||
| 1714 | 1714 | with manager() as x, manager(): | |
| 1715 | 1715 | pass | |
| 1716 | 1716 | ||
| 1717 | - if not use_old_parser(): | ||
| 1718 | - test_cases = [ | ||
| 1719 | - """if 1: | ||
| 1720 | - with ( | ||
| 1721 | - manager() | ||
| 1722 | - ): | ||
| 1723 | - pass | ||
| 1724 | - """, | ||
| 1725 | - """if 1: | ||
| 1726 | - with ( | ||
| 1727 | - manager() as x | ||
| 1728 | - ): | ||
| 1729 | - pass | ||
| 1730 | - """, | ||
| 1731 | - """if 1: | ||
| 1732 | - with ( | ||
| 1733 | - manager() as (x, y), | ||
| 1734 | - manager() as z, | ||
| 1735 | - ): | ||
| 1736 | - pass | ||
| 1737 | - """, | ||
| 1738 | - """if 1: | ||
| 1739 | - with ( | ||
| 1740 | - manager(), | ||
| 1741 | - manager() | ||
| 1742 | - ): | ||
| 1743 | - pass | ||
| 1744 | - """, | ||
| 1745 | - """if 1: | ||
| 1746 | - with ( | ||
| 1747 | - manager() as x, | ||
| 1748 | - manager() as y | ||
| 1749 | - ): | ||
| 1750 | - pass | ||
| 1751 | - """, | ||
| 1752 | - """if 1: | ||
| 1753 | - with ( | ||
| 1754 | - manager() as x, | ||
| 1755 | - manager() | ||
| 1756 | - ): | ||
| 1757 | - pass | ||
| 1758 | - """, | ||
| 1759 | - """if 1: | ||
| 1760 | - with ( | ||
| 1761 | - manager() as x, | ||
| 1762 | - manager() as y, | ||
| 1763 | - manager() as z, | ||
| 1764 | - ): | ||
| 1765 | - pass | ||
| 1766 | - """, | ||
| 1767 | - """if 1: | ||
| 1768 | - with ( | ||
| 1769 | - manager() as x, | ||
| 1770 | - manager() as y, | ||
| 1771 | - manager(), | ||
| 1772 | - ): | ||
| 1773 | - pass | ||
| 1774 | - """, | ||
| 1775 | - ] | ||
| 1776 | - for case in test_cases: | ||
| 1777 | - with self.subTest(case=case): | ||
| 1778 | - compile(case, "<string>", "exec") | ||
| 1717 | + with ( | ||
| 1718 | + manager() | ||
| 1719 | + ): | ||
| 1720 | + pass | ||
| 1721 | + | ||
| 1722 | + with ( | ||
| 1723 | + manager() as x | ||
| 1724 | + ): | ||
| 1725 | + pass | ||
| 1726 | + | ||
| 1727 | + with ( | ||
| 1728 | + manager() as (x, y), | ||
| 1729 | + manager() as z, | ||
| 1730 | + ): | ||
| 1731 | + pass | ||
| 1732 | + | ||
| 1733 | + with ( | ||
| 1734 | + manager(), | ||
| 1735 | + manager() | ||
| 1736 | + ): | ||
| 1737 | + pass | ||
| 1779 | 1738 | ||
| 1739 | + with ( | ||
| 1740 | + manager() as x, | ||
| 1741 | + manager() as y | ||
| 1742 | + ): | ||
| 1743 | + pass | ||
| 1744 | + | ||
| 1745 | + with ( | ||
| 1746 | + manager() as x, | ||
| 1747 | + manager() | ||
| 1748 | + ): | ||
| 1749 | + pass | ||
| 1750 | + | ||
| 1751 | + with ( | ||
| 1752 | + manager() as x, | ||
| 1753 | + manager() as y, | ||
| 1754 | + manager() as z, | ||
| 1755 | + ): | ||
| 1756 | + pass | ||
| 1757 | + | ||
| 1758 | + with ( | ||
| 1759 | + manager() as x, | ||
| 1760 | + manager() as y, | ||
| 1761 | + manager(), | ||
| 1762 | + ): | ||
| 1763 | + pass | ||
| 1780 | 1764 | ||
| 1781 | 1765 | def test_if_else_expr(self): | |
| 1782 | 1766 | # Test ifelse expressions in various cases | |
| Back | FazBrowse Home | New Git URL |
0 commit comments