Repository navigation
Stop superscript digits crashing the transcript reader - #58
Merged
Merged
Conversation
`agsearch read` crashed with "invalid literal for int() with base 10: '¹'" on a session that contained a footnote mark. `_condense_line_numbers` picks out runs of bare line numbers with `isdigit()` and then calls `int()` on them, and the two disagree: `isdigit()` accepts superscripts, `int()` rejects them. `isdecimal()` accepts exactly what `int()` parses, so the check and the conversion now agree. The same cleaner formats search result rows, so a match on such a message could crash a search as well.
medazizktata
pushed a commit
to medazizktata/ccfind
that referenced
this pull request
Nov 17, 2026
`agsearch read` crashed with "invalid literal for int() with base 10: '¹'" on a session that contained a footnote mark. `_condense_line_numbers` picks out runs of bare line numbers with `isdigit()` and then calls `int()` on them, and the two disagree: `isdigit()` accepts superscripts, `int()` rejects them. `isdecimal()` accepts exactly what `int()` parses, so the check and the conversion now agree. The same cleaner formats search result rows, so a match on such a message could crash a search as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
agsearch readcrashed on a real session:_condense_line_numbersfinds runs of bare line numbers withisdigit(), then callsint()on them.isdigit()accepts superscripts like¹, butint()rejects them.The same cleaner formats search result rows, so a match on such a message could crash a search too.
Fix
isdecimal()in both checks. It accepts exactly whatint()parses.tests/test_transcript.py.Test
python3 -m unittest discover tests: 182 tests pass.agsearch read 29d080cenow renders the session that crashed.