Skip to content

Commit

Permalink
fix syntax analysis in visit_Subscript
Browse files Browse the repository at this point in the history
  • Loading branch information
Technologicat committed May 2, 2021
1 parent cd2bcda commit 6172450
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mcpyrate/expander.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ def visit_Subscript(self, subscript):
# because things like `(some_expr_macro[tree])[subscript_expression]` are valid. This
# is actually exploited by `h`, as in `q[h[target_macro][tree_for_target_macro]]`.
candidate = subscript.value
macroname, macroargs = destructure_candidate(candidate, filename=self.filename)
macroname, macroargs = destructure_candidate(candidate, filename=self.filename,
_validate_call_syntax=False)
if self.ismacrocall(macroname, macroargs, "expr"):
# Now we know it's a macro invocation, so we can validate the parenthesis syntax to pass arguments.
macroname, macroargs = destructure_candidate(candidate, filename=self.filename)
kw = {"args": macroargs}
if sys.version_info >= (3, 9, 0): # Python 3.9+: no ast.Index wrapper
tree = subscript.slice
Expand Down

0 comments on commit 6172450

Please sign in to comment.