-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[native] make sure ParserError's line is zero-indexed #681
Conversation
Codecov Report
@@ Coverage Diff @@
## main #681 +/- ##
=======================================
Coverage 94.81% 94.81%
=======================================
Files 246 246
Lines 25607 25608 +1
=======================================
+ Hits 24279 24280 +1
Misses 1328 1328
Continue to review full report at Codecov.
|
let kwargs = [ | ||
("message", e.to_string().into_py(py)), | ||
("lines", lines.into_py(py)), | ||
("raw_line", line.into_py(py)), | ||
("raw_line", (line + 1).into_py(py)), | ||
("raw_column", col.into_py(py)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is column zero or one based?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Please clarify about raw_column
should be 0-indexed Lines 115 to 117 in 6e0c63a
|
Summary
The
ParserError
raised from the peg parser has 0-based line indices, but its__str__
implementation expects it to be 1-based. This causes exceptions while trying to render theParserError
exception.Fixes #678.
Test Plan
Added tests to verify
str()
doesn't blow up.