GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — io.BytesIO.__setstate__ rejects bytearray and memoryview inputs · Issue #9176 · RustPython/RustPython

io.BytesIO.__setstate__ rejects bytearray and memoryview inputs #9176

New issue
Copy link
New issue
Copy link
Open
Open
io.BytesIO.__setstate__ rejects bytearray and memoryview inputs#9176
Copy link
Assignees
doma17

Description

@doma17
doma17
opened on Oct 17, 2026
Issue body actions

BytesIO.__setstate__() accepts bytes, but rejects bytearray and
memoryview with TypeError. CPython 3.15 accepts all three.

import io

for data in (b"abc", bytearray(b"abc"), memoryview(b"abc")):
    stream = io.BytesIO()
    try:
        stream.__setstate__((data, 1, None))
        print(type(data).__name__, stream.read())
    except Exception as exc:
        print(type(data).__name__, type(exc).__name__)

Expected (CPython 3.15):

bytes b'bc'
bytearray b'bc'
memoryview b'bc'

Actual (RustPython):

bytes b'bc'
bytearray TypeError
memoryview TypeError

The existing CBytesIOTest.test_setstate in Lib/test/test_memoryio.py
already covers bytearray input, but is marked as an expected failure.

Reproduced on main 75a241704 on macOS arm64.

Activity

  1. doma17 commented on Oct 17, 2026

    @doma17
    doma17
    on Oct 17, 2026
    ContributorAuthor
    More actions

    take

  2. github-actions
    assigned
    doma17
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @doma17
    doma17

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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.