IronLanguages / IronLanguages/ironpython3
OSError.__init__ should do nothing
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
x = OSError()
x.__init__('abc')
assert x.args is ()
This is because in CPython all the work is done in OSError.__new__. For subclasses of OSError, if subclass.__init__ != OSError.__init__ and subclass.__new__ == OSError.__new__ then the work is done in OSError.__init__ instead of new:
class Test(OSError): pass
x = Test()
OSError.__init__(x, 1) # __init__ does nothing
assert x.args == ()
class Test2(OSError):
def __init__(self, *args): pass
x = Test2()
OSError.__init__(x, 1)
assert x.args == (1,)
class Test3(OSError):
def __new__(cls, *args):
return super().__new__(cls, *args)
x = Test3()
OSError.__init__(x, 1) # __init__ does nothing
assert x.args == ()
class Test4(OSError):
def __new__(cls, *args):
return super().__new__(cls, *args)
x = Test4()
OSError.__init__(x, 1) # __init__ does nothing
assert x.args == ()
This causes failures in CPython.test_pep3151 as well as IronPython.test_exceptions.
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 with the CPython.test_pep3151 and IronPython.test_exceptions failures, then trace OSError.new and OSError.init in IronPython. Done means the shown subclass cases preserve their expected args behavior and both reported test failures pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100