Skip to content

Commit c8ae54e

Browse files
committed
Improve ValueError for invalid plural forms
1 parent 5f56dd6 commit c8ae54e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/gettext.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,10 @@ def _parse(self, fp):
417417
v = v.split(';')
418418
try:
419419
plural = v[1].split('plural=')[1]
420-
except IndexError as e:
421-
raise ValueError('invalid plural forms syntax') from e
420+
except IndexError:
421+
raise ValueError(
422+
f"invalid plural forms syntax in '{filename}': '{v}'. Expected ';' and 'plural='."
423+
) from None
422424
self.plural = c2py(plural)
423425
# Note: we unconditionally convert both msgids and msgstrs to
424426
# Unicode using the character encoding specified in the charset

0 commit comments

Comments
 (0)