This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Different behaviour using super() and explicit base class.
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lajones, loewis, ncoghlan
Priority: normal Keywords:

Created on 2004-04-11 03:59 by lajones, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
scratch2.py lajones, 2004-04-11 03:59 Unit test that exhibits failure (testBroken asserts that the caller raises the assertion error).
Messages (3)
msg20478 - (view) Author: Lawrence Allan Jones (lajones) Date: 2004-04-11 03:59
I created a child class of threading.Thread. To invoke 
the parent __init__ method, I called super(C, 
self).__init__().

When called at run-time, Python threw an assertion 
exception informing me that the group parameter must 
be None. (The detailed error message was assert group 
is None, "group argument must be None for now".) I had 
not changed this parameter.

I created a similar class and explicitly called 
threading.Thread.__init__(). This call did not exhibit the 
fault at run-time.
msg20479 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2004-05-10 09:52
Logged In: YES 
user_id=1038590

This looks like a usage problem to me - the call to 
super() returns an already bound method object, hence 
'self' does not need to be supplied as an argument to the 
__init__ call. 
 
That is, the correct call to fix the 'Broken' class is: 
 
super(Broken, self).__init__() 
 
 
msg20480 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-07-15 06:35
Logged In: YES 
user_id=21627

The analysis is correct. This is not a bug in Python;
closing the report.
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40140
2004-04-11 03:59:10lajonescreate