summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-04-23 11:42:13 (GMT)
committerGitHub <noreply@github.com>2020-04-23 11:42:13 (GMT)
commit1df5a9e88c8df1495a2e689d71b34bf0c7d008ea (patch)
tree4ea11b6de7ba4e8e6408532fc92d4bf5e12f7d61 /Tools
parentee40e4b8563e6e1bc2bfb267da5ffc9a2293318d (diff)
downloadcpython-1df5a9e88c8df1495a2e689d71b34bf0c7d008ea.zip
cpython-1df5a9e88c8df1495a2e689d71b34bf0c7d008ea.tar.gz
cpython-1df5a9e88c8df1495a2e689d71b34bf0c7d008ea.tar.bz2
bpo-40334: Fix build errors and warnings in test_peg_generator (GH-19672)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/peg_generator/pegen/build.py2
-rw-r--r--Tools/peg_generator/pegen/c_generator.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py
index c66dc7e..bd792d6 100644
--- a/Tools/peg_generator/pegen/build.py
+++ b/Tools/peg_generator/pegen/build.py
@@ -9,6 +9,7 @@ import distutils.log
from distutils.core import Distribution, Extension
from distutils.command.clean import clean # type: ignore
from distutils.command.build_ext import build_ext # type: ignore
+from distutils.tests.support import fixup_build_ext
from pegen.c_generator import CParserGenerator
from pegen.grammar import Grammar
@@ -69,6 +70,7 @@ def compile_c_extension(
]
dist = Distribution({"name": extension_name, "ext_modules": extension})
cmd = build_ext(dist)
+ fixup_build_ext(cmd)
cmd.inplace = True
if build_dir:
cmd.build_temp = build_dir
diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py
index ce732a0..5b9d804 100644
--- a/Tools/peg_generator/pegen/c_generator.py
+++ b/Tools/peg_generator/pegen/c_generator.py
@@ -93,7 +93,9 @@ class CCallMakerVisitor(GrammarVisitor):
func, args = call.split("(", 1)
assert args[-1] == ")"
args = args[:-1]
- if not args.startswith("p,"):
+ if "name_token" in call:
+ return None, f"_PyPegen_lookahead_with_name({positive}, {func}, {args})"
+ elif not args.startswith("p,"):
return None, f"_PyPegen_lookahead({positive}, {func}, {args})"
elif args[2:].strip().isalnum():
return None, f"_PyPegen_lookahead_with_int({positive}, {func}, {args})"