erikrose / parsimonious

The fastest pure-Python PEG parser I can muster
MIT License
1.79k stars 126 forks source link

fix error handling for binary files #236

Open userx14 opened 12 months ago

userx14 commented 12 months ago

Error handling breaks when the parsed text is binary. The resulting error is: parsimonious.exceptions.IncompleteParseError: <exception str() failed>. This is caused because self.text.count('\n', 0, self.pos) needs a binary string for binary text. Generally getting the line where the error occured does not make for a binary file.