mirror of
https://github.com/python/cpython.git
synced 2025-10-12 01:43:12 +00:00
bpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)
This commit is contained in:
parent
2b74c835a7
commit
b94dbd7ac3
2 changed files with 1 additions and 2 deletions
|
@ -122,7 +122,6 @@ class CodeopTests(unittest.TestCase):
|
||||||
av("def f():\n pass\n#foo\n")
|
av("def f():\n pass\n#foo\n")
|
||||||
av("@a.b.c\ndef f():\n pass\n")
|
av("@a.b.c\ndef f():\n pass\n")
|
||||||
|
|
||||||
@support.skip_if_new_parser("Pegen does not support PyCF_DONT_INPLY_DEDENT yet")
|
|
||||||
def test_incomplete(self):
|
def test_incomplete(self):
|
||||||
ai = self.assertIncomplete
|
ai = self.assertIncomplete
|
||||||
|
|
||||||
|
|
|
@ -553,7 +553,7 @@ _PyPegen_fill_token(Parser *p)
|
||||||
type = NEWLINE; /* Add an extra newline */
|
type = NEWLINE; /* Add an extra newline */
|
||||||
p->parsing_started = 0;
|
p->parsing_started = 0;
|
||||||
|
|
||||||
if (p->tok->indent) {
|
if (p->tok->indent && !(p->flags & PyPARSE_DONT_IMPLY_DEDENT)) {
|
||||||
p->tok->pendin = -p->tok->indent;
|
p->tok->pendin = -p->tok->indent;
|
||||||
p->tok->indent = 0;
|
p->tok->indent = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue