One function
len in foutaise/texttable
The author described this change as “fix bug in wide chars handling”. It counts as a record because the check below fails on the code as it stood at 54d7362a7 and passes on 47e0ad62f, with nothing else changed between the two runs.
Projectfoutaise/texttable
Fix saved2017-10-14
Sharing licenceMIT · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
Redefining len here so it will be able to work with non-ASCII characters
The change
| 5 | 5 | unicode_data = obj2unicode(iterable) | |
| 6 | 6 | if hasattr(unicodedata, 'east_asian_width'): | |
| 7 | 7 | w = unicodedata.east_asian_width | |
| 8 | - | return sum([w(c) in 'WF' and 2 or 0 if unicodedata.combining(c) else 1 for c in unicode_data]) | |
| 8 | + | return sum([w(c) in 'WF' and 2 or (0 if unicodedata.combining(c) else 1) for c in unicode_data]) | |
| 9 | 9 | else: | |
| 10 | 10 | return unicode_data.__len__() | |
| 11 | 11 | else: |
The check that tells the two apart
fail→pass·tests.py::test_combining_char2
Check file tests.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 it54d7362a7d977a52a8c21222d43c7d5518666a32
Broken version dated2017-09-11
Moduletexttable
Units changedlen
Fingerprinta5687bd700f575db
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.