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

Multiline Context Manager 'with/as' parsing error #2264

Closed
jacobian91 opened this issue May 27, 2021 · 1 comment
Closed

Multiline Context Manager 'with/as' parsing error #2264

jacobian91 opened this issue May 27, 2021 · 1 comment
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working

Comments

@jacobian91
Copy link

Describe the bug
Black reports a parsing error when using multiline context managers using the 'with/as' pattern.

To Reproduce
Run the below code for the parsing issue. Then remove as x as y as z, this will run without issue.

with (
    open("xxxxxxxxxxxxxxxxxxxx", "w") as x,
    open("yyyyyyyyyyyyyyyyyyyyyy", "w") as y,
    open("zzzzzzzzzzzzzzzzzzz", "w") as z,
):
    x.write("x")
    y.write("y")
    z.write("z")

Expected behavior
No error, this is valid code that runs on python 3.9

Environment

  • Version: main
  • Windows Python 3.9.1

Does this bug also happen on main? To answer this, you have two options:
Yes, using https://black.vercel.app/?version=main

@JelleZijlstra
Copy link
Collaborator

See #1948.

@ichard26 ichard26 added C: blib2to3 R: duplicate This issue or pull request already exists T: bug Something isn't working labels May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants