]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40334: Support suppressing of multiple optional variables in Pegen (GH-20367)
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>
Sun, 24 May 2020 22:20:18 +0000 (01:20 +0300)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 22:20:18 +0000 (23:20 +0100)
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: