main icon indicating copy to clipboard operation
main copied to clipboard

Trivial: TypeError expected if __init__ returns something except None

Open ironpythonbot opened this issue 10 years ago • 1 comments

class C(object):  
    def __init__(self, arg):  
        return arg  

x = C(3)  

expected: TypeError: init() should return None, not 'int'
actual: no exception

Work Item Details

Original CodePlex Issue: Issue 23944 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 28, 2009 at 12:14 AM Reported by: dfugate Updated on: Feb 22, 2013 at 2:12 AM Updated by: jdhardy Custom value: Reported internally at Microsoft. CreatedDate: 2/4/2008 NewInternalID: 409770 OldInternalID: 374136 AreaPath: IronPython

Plaintext Attachments

CodePlex Issue #23944 Plain Text Attachments

ironpythonbot avatar Dec 09 '14 17:12 ironpythonbot

On 2011-02-07 06:25:14 UTC, rjnienaber commented:

Still occurring in 2.6.2 and 2.7b1 on .NET Version: 4.0.30319.1

python27 testcase-23944.py

Traceback (most recent call last): 
File "C:\ipy\testcase-23944.py", line 4, in <module>
x = C(3)
TypeError: __init__() should return None, not 'int'

ipy26 testcase-23944.py

ipy27 testcase-23944.py

ipy testcase-23944.py

ironpythonbot avatar Dec 09 '14 17:12 ironpythonbot