One function

singularize in mahmoud/boltons

The author described this change as fix(strutils): stop singularize() mangling words ending in 'ss'. It counts as a record because the check below fails on the code as it stood at 55dfe5077 and passes on 1e61524a7, with nothing else changed between the two runs.

Fix saved2026-07-17
Sharing licenceBSD-2-Clause · LICENSE
Change size+7 0

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

Semi-intelligently converts an English plural *word* to its singular form, preserving case pattern.

The change

2727 singular = word[:-3] + 'y'
2828 elif word.endswith('es') and word[-3] == 's':
2929 singular = word[:-2]
30+ elif word.endswith('ss'):
31+ # Words ending in a double 's' (glass, boss, kiss) are already
32+ # singular; their plurals end in 'sses' and are handled above. Do
33+ # not blindly strip the trailing 's', which would produce 'glas',
34+ # 'bos', 'kis' and break idempotency (singularize('Glasses') ==
35+ # 'Glass', but 'Glass' must stay 'Glass').
36+ return orig_word
3037 else:
3138 singular = word[:-1]
3239 return _match_case(orig_word, singular)

The check that tells the two apart

failpass·tests/test_strutils.py::test_singularize_double_s

Check file tests/test_strutils.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 it55dfe5077bcb5fa76611b5f2a557ea6c442ad87c
Broken version dated2026-07-17
Moduleboltons.strutils
Units changedsingularize
Fingerprint3c6ac80dd630cd20
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 mahmoud/boltons