Repository navigation
Fix ASC reader dropping the first frame after header comments - #2137
Conversation
Preserve the file position for a first data line encountered while parsing ASC header metadata so __iter__ processes it instead of consuming it. Add a regression test with CANoe-style version comments.
AI Review: Request changesThanks for tracking this down. The bug is real: when the ASC header has no Blocking: non-seekable streams no longer work
Suggested fix: hand the line back instead of rewinding
I tried this locally: all ASC tests pass, including your new one, mypy is clean, and the first frame is read from files, Also needed
|
|
Updated the implementation to hand the first non-header line back through itertools.chain instead of rewinding the stream. This avoids seek/tell requirements and keeps pipe, StringIO, file, and gzip inputs compatible. Also added doc/changelog.d/2137.fixed.rst with the precise affected-file and Begin Triggerblock behavior. Validation: complete ASC selection passes (32 passed, 1 skipped), and new file/StringIO regressions pass. |
…te#2137) * Fix ASC reader dropping first frame after header comments Preserve the file position for a first data line encountered while parsing ASC header metadata so __iter__ processes it instead of consuming it. Add a regression test with CANoe-style version comments. * Fix ASC header data line handling --------- Co-authored-by: Zhao Jiale <zhaojiale2021@users.noreply.github.com>
Summary
ASCReader._extract_header()currently consumes the first data line when it follows header metadata or a version comment. The line is not an ASC header field, but it is not rewound for__iter__(), so the first frame is silently lost.Changes
Testing
python -m pytest -q test/logformats_test.py -k "first_message_after_header_comment"