Message1023
A class created with multiple inheritance from a built-in type and a
non built-in type has faulty method look-up.
For example:
>>> class myClass:
... def foo(self):
... print "myClass foo called."
>>> class myMulti(dict, myClass):
... pass
...
>>> t = myMulti()
>>> type(t)
<class '__main__.myMulti'>
>>> t.foo()
Traceback (innermost last):
File "<console>", line 1, in ?
AttributeError: 'dict' object has no attribute 'foo'
If the order or the inheritance is changed a java ClassCastException
is thrown at class creation.
>>> class myMulti2(myClass, dict):
... pass
...
Traceback (innermost last):
File "<console>", line 1, in ?
java.lang.ClassCastException
at org.python.core.PyClass.init(Unknown Source)
at org.python.core.PyClass.<init>(Unknown Source)
at org.python.core.Py.makeClass(Unknown Source)
at org.python.core.Py.makeClass(Unknown Source)
at org.python.pycode._pyx2.f$0(<console>:1)
at org.python.pycode._pyx2.call_function(<console>)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyCode.call(Unknown Source)
at org.python.core.Py.runCode(Unknown Source)
at org.python.core.Py.exec(Unknown Source)
at org.python.util.PythonInterpreter.exec(Unknown Source)
at org.python.util.InteractiveInterpreter.runcode(Unknown
Source)
at org.python.util.InteractiveInterpreter.runsource(Unknown
Source)
at org.python.util.InteractiveInterpreter.runsource(Unknown
Source)
at org.python.util.InteractiveConsole.push(Unknown Source)
at org.python.util.InteractiveConsole.interact(Unknown Source)
at org.python.util.jython.main(Unknown Source)
java.lang.ClassCastException: java.lang.ClassCastException
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:24 | admin | link | issue1264260 messages |
2008-02-20 17:17:24 | admin | create | |
|