Fix unicode handling in patched ast - #872
Open
lieryan wants to merge 7 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #872 +/- ##
==========================================
+ Coverage 95.29% 95.33% +0.04%
==========================================
Files 134 134
Lines 26541 26766 +225
==========================================
+ Hits 25291 25517 +226
+ Misses 1250 1249 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
lieryan
force-pushed
the
lieryan-implement-ast-lines-adapter
branch
from
September 7, 2026 03:09
c543d4c to
17a258f
Compare
ASTLinesAdapter uses ast-produced col_offset/end_col_offset which are produced by the python's own parser to calculate convert offsets to str offset, which should be more reliable than the ad-hoc calculations that generally would only have worked with ASCII-only source code.
col_offset/end_col_offset uses utf-8 offset which generally only accidentally coincides with str-offset that rope uses as node.region. ASTLinesAdapter ensures correct computation of offset.
All slices are handled by __getitem__() since Python 3.
Now we have a better ASTLinesAdapter that actually handles unicode correctly.
lieryan
force-pushed
the
lieryan-implement-ast-lines-adapter
branch
from
September 7, 2026 03:17
17a258f to
a6e3025
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please include a summary of the change and which issue is fixed.
Checklist (delete if not relevant):