Skip to content

StringIO does not report observed newline types #8513

Description

@doma17

io.StringIO does not report newline types through its newlines attribute.

import io

stream = io.StringIO(newline=None)
stream.write("a\nb\r\nc\rd")

print(stream.newlines)

CPython returns:

("\r", "\n", "\r\n")

RustPython currently inherits _TextIOBase.newlines, which returns None.

The same behavior is covered by the existing expected-failure tests in Lib/test/test_memoryio.py.

AI assistance: Codex:gpt-5.6-sol (research and drafting; reviewed and edited by the contributor).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions