Repository navigation
fix: retain UART readline newline terminators - #319
YashAnand69 wants to merge 2 commits into
Conversation
|
Sorry @YashAnand69, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 6 hours and 57 minutes by commenting |
Reviewer's GuideFix UART readline framing by appending bytes before checking for LF, so complete lines retain their newline terminators without consuming subsequent data. Add focused transport-level tests covering line framing, timeout semantics, raw reads, binary data, byte limits, and buffer preservation. Sequence diagram for UART readline framingsequenceDiagram
participant Caller
participant UART
participant Transport
Caller->>UART: readline()
UART->>Transport: _read_byte()
Transport-->>UART: byte
UART->>UART: data.append(char)
alt char == 0xA
UART-->>Caller: complete line including LF
else char != 0xA
UART->>Transport: _read_byte()
Transport-->>UART: next byte
UART-->>Caller: line or timeout result
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk | ⚪ Minimal · up to
|
Fixes #318.
UART.readline()consumed LF before adding it to the returned bytes. A blank line therefore returnedNone, indistinguishable from a timeout, and CRLF lines lost their LF. Append the byte before checking for the line terminator, preserving complete line framing without consuming the next line.This restores the documented CircuitPython-style newline contract. Complete lines now include LF; partial timeout results, raw reads, polling and constructor/parity handling are unchanged.
Validation: five framing regressions fail on unchanged main while five controls pass. All ten focused cases and 33 existing hardware-independent tests pass with the fix. Tests exercise the actual UART status/read command path with controlled firmware replies and clock. Configured source/test Black, Flake8, Bandit and pydocstyle, isolated wheel/sdist builds and Sphinx pass (seven existing docs warnings). Same-selection busio coverage remains 48.148%; this is not a whole-package or physical-hardware coverage claim.
Prepared with Codex assistance and reviewed against the method documentation and CircuitPython/pySerial line-reading contracts. No physical UART integration was performed. This read-path fix is separate from #317's constructor parity handling.
Summary by Sourcery
Restore complete UART line framing by retaining newline terminators while preserving timeout and raw-read behavior.
Bug Fixes:
Tests:
Summary by CodeRabbit