Skip to content

Overridden method called instead of base class method #1808

@slozier

Description

@slozier

The following throws an exception instead of succeeding:

from io import BytesIO
f = BytesIO()
f.read()

class MyBytesIO(BytesIO):
    def read(self, n=None):
        raise Exception

f = MyBytesIO()
BytesIO.read(f)

See also #1129 and #1070.


Ran into this issue when trying to run:

make.ps1 test-"CPython.test_iter|IronPython.test_io_stdlib"

In this case it was causing a StackOverflowException:

from io import BytesIO
f = BytesIO()
f.read()

class MyBytesIO(BytesIO):
    def read(self, n=None):
        return super().read(n)

f = MyBytesIO()
f.read()

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