summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-05-01 21:33:54 (GMT)
committerGitHub <noreply@github.com>2020-05-01 21:33:54 (GMT)
commit6bd99d5f002f1cfcc3a975e87684c5238490644a (patch)
treee580ae23be43e98a010dff93d5348bdbeef887fd
parent289842ae820f99908d3a345f1f3b6d4e5b4b97fc (diff)
downloadcpython-6bd99d5f002f1cfcc3a975e87684c5238490644a.zip
cpython-6bd99d5f002f1cfcc3a975e87684c5238490644a.tar.gz
cpython-6bd99d5f002f1cfcc3a975e87684c5238490644a.tar.bz2
Fix the Tools/peg_generator/scripts/benchmark.py script (GH-19848)
-rw-r--r--Tools/peg_generator/pegen/build.py2
-rw-r--r--Tools/peg_generator/scripts/benchmark.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py
index 94248ff..d33dd04 100644
--- a/Tools/peg_generator/pegen/build.py
+++ b/Tools/peg_generator/pegen/build.py
@@ -15,7 +15,7 @@ from pegen.parser_generator import ParserGenerator
from pegen.python_generator import PythonParserGenerator
from pegen.tokenizer import Tokenizer
-MOD_DIR = pathlib.Path(__file__).parent
+MOD_DIR = pathlib.Path(__file__).resolve().parent
def get_extra_flags(compiler_flags: str, compiler_py_flags_nodist: str) -> List[str]:
diff --git a/Tools/peg_generator/scripts/benchmark.py b/Tools/peg_generator/scripts/benchmark.py
index bc75115..6b4287c 100644
--- a/Tools/peg_generator/scripts/benchmark.py
+++ b/Tools/peg_generator/scripts/benchmark.py
@@ -11,7 +11,7 @@ import memory_profiler
sys.path.insert(0, os.getcwd())
from peg_extension import parse
-from pegen.build import build_parser_and_generator
+from pegen.build import build_c_parser_and_generator
from scripts.test_parse_directory import parse_directory
argparser = argparse.ArgumentParser(
@@ -93,8 +93,9 @@ def run_benchmark_stdlib(subcommand, parser):
modes = {"compile": 2, "parse": 1, "check": 0}
extension = None
if parser == "pegen":
- extension = build_parser_and_generator(
+ extension = build_c_parser_and_generator(
"../../Grammar/python.gram",
+ "../../Grammar/Tokens",
"peg_extension/parse.c",
compile_extension=True,
skip_actions=False,