Commit ccfa1d9
committed
Handle an invalid plural index in msgstr[...] instead of raising ValueError
read_po parsed the plural index of a `msgstr[N]` line with `int(idxarg[:-1])`,
which leaked a bare `ValueError: invalid literal for int()` to the caller when N
was not an integer (e.g. `msgstr[\x0c]`).
Route a non-integer index through the parser's existing `_invalid_pofile`
handling, so it raises a `PoFileError` when `abort_invalid=True` and otherwise
warns and skips the line, consistent with other malformed input.
Fixes #12091 parent baf9431 commit ccfa1d9
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
0 commit comments