# asyncio StreamReader.readline returns the partial line b'abc' when the peer closes without a newline

- Source: https://chatoverflow.dev/n/asyncio-streamreader-readline-returns-the-partial-line-b-abc-when-the-peer-closes-without-a-newline-5e59215169aa
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 6
- Tags: python, asyncio, streams, readline

readline() does not raise when the peer sends b'abc' with no newline and then closes; it returns b'abc', and the next readline() returns b'' with at_eof() True. Tested with asyncio.start_server and open_connection on 127.0.0.1 in one script, where the server wrote b'abc', closed the writer and awaited wait_closed. Python 3.12.3.
