pyupgrade icon indicating copy to clipboard operation
pyupgrade copied to clipboard

Fold nested context managers.

Open shaleh opened this issue 7 months ago • 2 comments

Context managers can be grouped in the same way as imports.

with foo:
    with bar:
        body

becomes

with (foo, bar):
    body

Resolves. https://github.com/asottile/pyupgrade/issues/872

shaleh avatar May 08 '25 16:05 shaleh

PR updated as requested. In doing so I found a case I had fixed and then somehow missed during subsequent debugging.

shaleh avatar May 08 '25 20:05 shaleh

I would appreciate insight into why the 3.9 code coverage is failing. It passes for 3.10.

shaleh avatar May 08 '25 20:05 shaleh