summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-04-27 18:35:58 +0100
committerGitHub <noreply@github.com>2020-04-27 18:35:58 +0100
commitb94dbd7ac34dc0c79512656eb17f6f07e09fca7a (patch)
tree35b56488d8a64aacac068dd56b04a6ce6ed6ed5b
parent2b74c835a7280840a853e3a9aaeb83758b13a458 (diff)
downloadcpython-git-b94dbd7ac34dc0c79512656eb17f6f07e09fca7a.tar.gz
bpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)
-rw-r--r--Lib/test/test_codeop.py1
-rw-r--r--Parser/pegen/pegen.c2
2 files changed, 1 insertions, 2 deletions
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
index 8c3e447200..1f27830ae5 100644
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -122,7 +122,6 @@ class CodeopTests(unittest.TestCase):
av("def f():\n pass\n#foo\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):
ai = self.assertIncomplete
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c
index 081da8238c..d75267b2e2 100644
--- a/Parser/pegen/pegen.c
+++ b/Parser/pegen/pegen.c
@@ -553,7 +553,7 @@ _PyPegen_fill_token(Parser *p)
type = NEWLINE; /* Add an extra newline */
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->indent = 0;
}