• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gristlabs / asttokens / 29176076671
95%

Build:
DEFAULT BRANCH: master
Ran 12 Jul 2026 02:00AM UTC
Jobs 1
Files 6
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Jul 2026 01:59AM UTC coverage: 94.793% (+0.02%) from 94.774%
29176076671

push

github

web-flow
Fix IndexError on source mixing lone CR with LF line endings (#105) (#174)

* Treat a lone "\r" as a line boundary in LineNumbers

Fixes #105.

`ASTTokens(src, parse=True)` raised `IndexError: list index out of
range` on valid source that mixes a lone "\r" (old-Mac line ending) with
"\n" and ends with an attribute access, e.g. the minimal reproducer
"\ry.y\n".

`LineNumbers` computed line starts with a `re.M` `^`, which does not
treat a lone "\r" as a line boundary. Python's tokenizer and `ast`
module do, so AST node positions on the line after a "\r" were mapped to
a character offset past the source text and thus onto the ENDMARKER
token. `MarkTokens.handle_attr` then called `next_token` on the
ENDMARKER, walking past the end of the token list.

Compute line starts from the actual end-of-line sequences ("\r\n", "\r"
or "\n") instead, matching how source lines are numbered elsewhere.
"\r\n"- and "\n"-only sources are unaffected.

Add regression tests for the line-offset handling and for marking
tokens on CR/LF-mixed sources.

* Normalize lone carriage returns before tokenizing

* Strengthen mixed line ending tests

227 of 243 branches covered (93.42%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

574 of 602 relevant lines covered (95.35%)

16.2 hits per line

Jobs
ID Job ID Ran Files Coverage
1 29176076671.1 12 Jul 2026 02:06AM UTC 6
94.79
GitHub Action Run
Source Files on build 29176076671
  • Tree
  • List 6
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • bb3c487d on github
  • Prev Build on master (#27579586751)
  • Next Build on master (#29178277584)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc