Index: Lib/test/test_java_subclasses.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- Lib/test/test_java_subclasses.py (revision 7672:95d09ba14aa7834f1e2cebcfb48593dc3b480f69) +++ Lib/test/test_java_subclasses.py (revision 7672+:95d09ba14aa7+) @@ -13,6 +13,7 @@ from java.awt import Color, Component, Dimension, Rectangle from javax.swing import ComboBoxModel, ListModel from javax.swing.table import AbstractTableModel +from javax.swing.tree import DefaultTreeModel, DefaultMutableTreeNode from org.python.tests import BeanInterface, Callbacker, Coercions, OwnMethodCaller @@ -459,6 +460,25 @@ self.assertEqual(my_list.size(), 6) +class OldAndNewStyleInitSuperTest(unittest.TestCase): + """ + http://bugs.jython.org/issue2375 + """ + + def test_new_style_init(self): + class AModel(DefaultTreeModel): + def __init__(self): + super(AModel, self).__init__(DefaultMutableTreeNode()) + + AModel() + + def test_old_style_init(self): + class AModel(DefaultTreeModel): + def __init__(self): + DefaultTreeModel.__init__(self, DefaultMutableTreeNode()) + + AModel() + def test_main(): test_support.run_unittest( InterfaceTest, @@ -469,7 +489,8 @@ ContextClassloaderTest, MetaClassTest, AbstractMethodTest, - SuperIsSuperTest) + SuperIsSuperTest, + OldAndNewStyleInitSuperTest) if __name__ == '__main__': Index: src/org/python/core/PyType.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/org/python/core/PyType.java (revision 7672:95d09ba14aa7834f1e2cebcfb48593dc3b480f69) +++ src/org/python/core/PyType.java (revision 7672+:95d09ba14aa7+) @@ -1303,7 +1303,9 @@ // So break out of this infinite loop by ignoring this entry for super purposes. // The use of super__ parallels the workaround seen in PyReflectedFunction // Fixes http://bugs.jython.org/issue1540 - if(!name.startsWith("super__")) { + // Also ignore this if we're doing super during __init__ as we want it to behave + // Fixes http://bugs.jython.org/issue2375 + if(name != "__init__" && !name.startsWith("super__")) { lookupName = "super__" + name; } else { lookupName = name;