Repository navigation
Conversation
Signed-off-by: Rishabh Rohil <rishabhrohil024@gmail.com>
hastagAB
left a comment
There was a problem hiding this comment.
@rishabh23rohil Good fix for the encoding issue, but two things need to be addressed.
-
Missing error handler:
encoding="utf-8"without an error handler will still raiseUnicodeDecodeErroron files with invalid UTF-8 bytes, which is the exact scenario this PR aims to prevent. Adderrors="replace"to all four calls. -
Broken regex in
extractAssignedString: The look-behind in the regex is variable-width, which causesre.errorat runtime. This is out of scope for this PR but worth fixing before merging.
Please address the error handler and this is good to go.
…egex Address review feedback: - Add errors="replace" to all four open() calls so files with invalid UTF-8 bytes are handled gracefully instead of raising UnicodeDecodeError. - Replace variable-width lookbehind in extractAssignedString regex with a simpler capturing-group pattern that avoids re.error at runtime. All 75 existing tests pass. Signed-off-by: Rishabh Rohil <rishabhrohil024@gmail.com>
8e5773b to
a87540f
Compare
|
@hastagAB Thanks for the review! Addressed both points in the latest commit: Added errors="replace" to all four open() calls so invalid UTF-8 bytes are gracefully replaced instead of raising UnicodeDecodeError. Fixed the variable-width lookbehind in extractAssignedString — the \s* inside the lookbehind caused re.error at runtime. Replaced it with a simpler capturing-group pattern that matches the same strings. All 75 existing tests pass. Please let me know if there's anything else! |
a87540f to
d03952c
Compare
All four file-reading functions in binder.py use open(file) without specifying encoding. On systems where the default encoding is not utf-8, this causes UnicodeDecodeError when parsing source files with non-ASCII characters like copyright symbols or accented author names. Added encoding=utf-8 to all four open() calls. All 75 existing tests pass. FOSSology v4.6.0.115 running locally via Docker.