]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)
authorPablo Galindo <Pablogsal@gmail.com>
Mon, 27 Apr 2020 17:35:58 +0000 (18:35 +0100)
committerGitHub <noreply@github.com>
Mon, 27 Apr 2020 17:35:58 +0000 (18:35 +0100)
Lib/test/test_codeop.py
Parser/pegen/pegen.c

index 8c3e447200d404d9cdff2495d7d52f9fa9fe3e25..1f27830ae50b841041a82f36f6c44c9f3f4d379a 100644 (file)
@@ -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
 
index 081da8238c35ca6bebcacffc02a2f1021f366c82..d75267b2e2778a17adc005c0ab9fd6114f379340 100644 (file)
@@ -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;
         }