Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Github issue 855 - fail to parse with statement
When we added support for parenthesized with statements, the grammar on the with itself was correct (it's a right and left parenthesis around a comma-separated list of with-items, with a possible trailing comma). But inside of the "as" variation of the with_item rule we have a peek at the next character, which was allowing for a comma or a colon. That peek needs to also accept right parentheses - otherwise, if the last item contains an `as` and has no trailing comma we fail to parse. The bug is exercisecd by, for example, this code snippet: ``` with (foo, bar as bar,): pass ``` The with_wickedness test fixture has been revised to include both the plain and async variations of this example snippet with and without trailing comma, and tests pass after the peek rule fix.
- Loading branch information