Bugs item #1183959, was opened at 2005-04-15 14:16 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1183959&group_id=5470
Category: Python Interpreter Core Group: Python 2.4 >Status: Closed >Resolution: Out of Date Priority: 5 Submitted By: Adal Chiriliuc (adalx) Assigned to: Nobody/Anonymous (nobody) Summary: return val in __init__ doesn't raise TypeError in new-style Initial Comment: returning a value (other than None) from __init__ is supposed to raise TypeError. This only works for old-style classes. ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2005-04-18 12:11 Message: Logged In: YES user_id=80475 This has been fixed for 2.4.1 where a RuntimeWarning is raised and in 2.5.0a where a TypeError is raised. ---------------------------------------------------------------------- Comment By: Adal Chiriliuc (adalx) Date: 2005-04-15 14:20 Message: Logged In: YES user_id=1067739 # I've failed to attach this file so I've added a comment. This should be modified to report eventual failure and added to the test library. class LegalConstructor1(object): def __init__(self): return class LegalConstructor2(object): def __init__(self): return None class IlegalConstructor(object): def __init__(self): return "x" class LegalConstructorOld1: def __init__(self): return class LegalConstructorOld2: def __init__(self): return None class IlegalConstructorOld: def __init__(self): return "x" a = LegalConstructor1() print a b = LegalConstructor2() print b x = LegalConstructorOld1() print a y = LegalConstructorOld2() print b # !!! This should raise TypeError c = IlegalConstructor() print c z = IlegalConstructorOld() print z ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1183959&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com