]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 24 May 2020 22:38:47 +0000 (15:38 -0700)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 22:38:47 +0000 (15:38 -0700)
(cherry picked from commit cba503151056b448b7a3730dc36ef6655550ade5)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Tools/peg_generator/pegen/c_generator.py

index 362698b0df62e2535f4d7756b42cb6c39592628d..1249d4f683e261d892c08d284bb1834fbe99933e 100644 (file)
@@ -694,8 +694,8 @@ class CParserGenerator(ParserGenerator, GrammarVisitor):
                 if v == "_cut_var":
                     v += " = 0"  # cut_var must be initialized
                 self.print(f"{var_type}{v};")
-                if v == "_opt_var":
-                    self.print("UNUSED(_opt_var); // Silence compiler warnings")
+                if v.startswith("_opt_var"):
+                    self.print(f"UNUSED({v}); // Silence compiler warnings")
 
             with self.local_variable_context():
                 if is_loop: