Skip to content

Commit 160c037

Browse files
committed
Fix pypy issue
1 parent 237593d commit 160c037

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

coconut/compiler/compiler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,7 +2406,7 @@ def split_docstring(self, block):
24062406
return first_line, rest_of_lines
24072407
return None, block
24082408

2409-
def tre_return_handle(self, func_name, func_args, func_store, mock_var, loc, tokens):
2409+
def tre_return_handle(self, func_name, func_args, func_store, mock_var, original, loc, tokens):
24102410
"""Handler for tre_return_grammar."""
24112411
args = ", ".join(tokens)
24122412

@@ -2446,6 +2446,8 @@ def tre_return_handle(self, func_name, func_args, func_store, mock_var, loc, tok
24462446
type_ignore=self.type_ignore_comment(),
24472447
)
24482448

2449+
tre_return_handle.trim_arity = False # fixes pypy issue
2450+
24492451
def tre_return_grammar(self, func_name, func_args, func_store, mock_var=None):
24502452
"""Generate grammar element that matches a string which is just a TRE return statement."""
24512453
self.tre_func_name <<= base_keyword(func_name).suppress()

coconut/compiler/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ def cached_parse(
751751
# only iterate over keys, not items, so we don't mark everything as alive
752752
for key in computation_graph_cache:
753753
prefix, is_at_end = key
754+
if DEVELOP: # avoid overhead
755+
internal_assert(cache_prefixes or is_at_end, "invalid computation graph cache item", key)
754756
# the assumption here is that if the prior parse didn't make it to the end,
755757
# then we can freely change the text after the end of where it made it,
756758
# but if it did make it to the end, then we can't add more text after that

0 commit comments

Comments
 (0)