Skip to content

Commit

Permalink
Fix pypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Oct 20, 2024
1 parent 237593d commit 160c037
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion coconut/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ def split_docstring(self, block):
return first_line, rest_of_lines
return None, block

def tre_return_handle(self, func_name, func_args, func_store, mock_var, loc, tokens):
def tre_return_handle(self, func_name, func_args, func_store, mock_var, original, loc, tokens):
"""Handler for tre_return_grammar."""
args = ", ".join(tokens)

Expand Down Expand Up @@ -2446,6 +2446,8 @@ def tre_return_handle(self, func_name, func_args, func_store, mock_var, loc, tok
type_ignore=self.type_ignore_comment(),
)

tre_return_handle.trim_arity = False # fixes pypy issue

def tre_return_grammar(self, func_name, func_args, func_store, mock_var=None):
"""Generate grammar element that matches a string which is just a TRE return statement."""
self.tre_func_name <<= base_keyword(func_name).suppress()
Expand Down
2 changes: 2 additions & 0 deletions coconut/compiler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ def cached_parse(
# only iterate over keys, not items, so we don't mark everything as alive
for key in computation_graph_cache:
prefix, is_at_end = key
if DEVELOP: # avoid overhead
internal_assert(cache_prefixes or is_at_end, "invalid computation graph cache item", key)
# the assumption here is that if the prior parse didn't make it to the end,
# then we can freely change the text after the end of where it made it,
# but if it did make it to the end, then we can't add more text after that
Expand Down

0 comments on commit 160c037

Please sign in to comment.