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.

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

319319 sorted_statements, graph=runtime_graph
320320 )
321321
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+ ]
324326
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)
333333
334334
335335 def statement_text_sorted(statement):

The check that tells the two apart

failpass·tests/test_ssort.py::test_inner_class_in_sorted_outer_class
failpass·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