Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MismatchedTokenError when empty tuple has commented out line #789

Open
apmorton opened this issue May 1, 2024 · 0 comments · May be fixed by #790
Open

MismatchedTokenError when empty tuple has commented out line #789

apmorton opened this issue May 1, 2024 · 0 comments · May be fixed by #790
Labels
bug Unexpected or incorrect user-visible behavior

Comments

@apmorton
Copy link
Contributor

apmorton commented May 1, 2024

Given code like:

a = (
    # foo,
)

get_patched_ast will incorrectly scan past the empty tuple and cause MismatchedTokenError.

The following test case will blow up in _consume_pattern because it does not match the pattern

    def test_empty_tuple_node4(self):
        source = "a = (\n# foo,\n)"
        ast_frag = patchedast.get_patched_ast(source, True)
        checker = _ResultChecker(self, ast_frag)
        checker.check_children("Tuple", ["()"])
@apmorton apmorton added the bug Unexpected or incorrect user-visible behavior label May 1, 2024
@apmorton apmorton linked a pull request May 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant