IronLanguages / IronLanguages/ironpython3
Overridden method called instead of base class method
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
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 https://github.com/IronLanguages/ironpython3/issues/1129 and https://github.com/IronLanguages/ironpython3/issues/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()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the BytesIO subclass cases in the issue, then run make.ps1 test-"CPython.test_iter|IronPython.test_io_stdlib" to observe the related failure. Trace the BytesIO method dispatch and inheritance behavior in the IronPython implementation. Done means BytesIO.read(f) bypasses the override and super().read(n) no longer recurses or raises unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100