Skip to content

attribute dict of _io._IOBase and of user-defined subclasses are not the same #1003

@slozier

Description

@slozier

#1000 adds __dict__ to _io._IOBase but it exposes the following issue:

import _io

b = _io.BytesIO()
b.foo = 2
assert "foo" in dir(b) # this currently fails
assert "foo" in b.__dict__

class Test(_io.BytesIO): pass

b = Test()
b.foo = 2
assert "foo" in dir(b)
assert "foo" in b.__dict__ # this currently fails

This causes pickling failures in CPython.test_memoryio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions