One function

_get_bindings_for_with in bwhmather/ssort

The author described this change as Fix support for with blocks. It counts as a record because the check below fails on the code as it stood at df014e93f and passes on 31c5bf7a7, with nothing else changed between the two runs.

Fix saved2021-04-06
Sharing licenceMIT · LICENSE
Change size+3 0

What the code was meant to do, written into the code itself as a docstring

..code:: python With(withitem* items, stmt* body, string? type_comment) ..code:: python AsyncWith(withitem* items, stmt* body, string? type_comment)

The change

1111 for item in node.items:
1212 if item.optional_vars:
1313 yield from _flatten_target(item.optional_vars)
14+
15+ for stmt in node.body:
16+ yield from get_bindings(stmt)

The check that tells the two apart

failpass·tests/test_bindings.py::test_with_dependencies_bindings

Check file tests/test_bindings.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itdf014e93f76a620bb8e8044718e9a4537e279b1d
Broken version dated2021-04-06
Modulessort._bindings
Units changed_get_bindings_for_with
Fingerprint43b86465c4c2a589
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in bwhmather/ssort