From f8b11d7465766f63dc49500ded9eda69f044feb2 Mon Sep 17 00:00:00 2001 From: Evan Hubinger Date: Sun, 20 Oct 2024 01:20:12 -0700 Subject: [PATCH] Further fix pypy --- coconut/compiler/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coconut/compiler/util.py b/coconut/compiler/util.py index 3edb4090..8aac0d30 100644 --- a/coconut/compiler/util.py +++ b/coconut/compiler/util.py @@ -746,7 +746,12 @@ def cached_parse( ): """Version of parse that caches the result when it's a pure ComputationNode.""" if not CPYPARSING: # caching is only supported on cPyparsing - return (parse_where if scan_string else parse)(grammar, text, inner) + if scan_string: + for tokens, start, stop in all_matches(grammar, text, inner, eval_parse_tree=False): + return tokens, start, stop + return None, None, None + else: + return parse(grammar, text, inner) # only iterate over keys, not items, so we don't mark everything as alive for key in computation_graph_cache: