Whole file
bwhmather/ssort
The author described this change as “Fix handling of nested classes”. It counts as a record because the checks below fail on the code as it stood at b2e455e04 and pass on 85111ef1f, with nothing else changed between the two runs.
Projectbwhmather/ssort
Fix saved2026-08-03
Sharing licenceMIT · LICENSE
Change size+10 −10
What the code was meant to do, written into the code itself as a save note
Fix handling of nested classes
The change
| 319 | 319 | sorted_statements, graph=runtime_graph | |
| 320 | 320 | ) | |
| 321 | 321 | ||
| 322 | - | if sorted_statements == unsorted_statements: | |
| 323 | - | return statement.text | |
| 322 | + | # === Sort nested statements =============================================== | |
| 323 | + | sorted_statement_texts = [ | |
| 324 | + | statement_text_sorted(statement) for statement in sorted_statements | |
| 325 | + | ] | |
| 324 | 326 | ||
| 325 | - | return ( | |
| 326 | - | head_text | |
| 327 | - | + "\n" | |
| 328 | - | + "\n".join( | |
| 329 | - | statement_text_sorted(body_statement) | |
| 330 | - | for body_statement in sorted_statements | |
| 331 | - | ) | |
| 332 | - | ) | |
| 327 | + | unsorted_statement_texts = [ | |
| 328 | + | statement.text for statement in unsorted_statements | |
| 329 | + | ] | |
| 330 | + | if sorted_statement_texts == unsorted_statement_texts: | |
| 331 | + | return statement.text | |
| 332 | + | return head_text + "\n" + "\n".join(sorted_statement_texts) | |
| 333 | 333 | ||
| 334 | 334 | ||
| 335 | 335 | def statement_text_sorted(statement): |
The check that tells the two apart
fail→pass·tests/test_ssort.py::test_inner_class_in_sorted_outer_class
fail→pass·tests/test_ssort.py::test_inner_class_nested_in_sorted_outer_classes
Check file tests/test_ssort.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 itb2e455e04f1dae233a2910dd826494301850cc08
Broken version dated2026-07-26
Modulessort._ssort
Units changed_statement_text_sorted_class
Fingerprintdad5a10eebb63e2e
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
- 2024-01-18Fix detection of self argument name when positional-only
- 2022-07-22Fix lambda requirements with walrus operator
- 2021-08-08_get_bindings_for_named_expr
- 2021-04-06_get_bindings_for_import
- 2021-04-06_get_bindings_for_with
- 2021-03-29Fix dependencies being return for bindings in comprehensions