Skip to content

StringIO does not report observed newline types #8513

Closed

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.

Activity

  1. doma17 commented on Aug 17, 2026

    @doma17
    ContributorAuthor

    take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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