Issue449316
Created on 2001-08-08.22:47:57 by xoltar, last changed 2001-08-11.10:41:13 by bckfnn.
Messages | |||
---|---|---|---|
msg378 (view) | Author: Bryn Keller (xoltar) | Date: 2001-08-08.22:47:57 | |
When using a Java Collection class (such as ArrayList), Jython will allow you to take [0] of an empty collection. Unfortunately, [0] is a null or something, so it has very strange behavior as shown below: >>> from java.util import ArrayList import: 'ArrayList' as java class >>> al = ArrayList() >>> foo = al[0] >>> foo Traceback (innermost last): File "<console>", line 1, in ? NameError: foo >>> print al[0] Traceback (innermost last): File "<console>", line 1, in ? java.lang.NullPointerException at org.python.core.StdoutWrapper.print(StdoutWrapper.java) at org.python.core.StdoutWrapper.println(StdoutWrapper.java) at org.python.core.Py.println(Py.java) at org.python.pycode._pyx5.f$0(<console>:1) at org.python.pycode._pyx5.call_function(<console>) at org.python.core.PyTableCode.call(PyTableCode.java) at org.python.core.PyCode.call(PyCode.java) at org.python.core.Py.runCode(Py.java) at org.python.core.Py.exec(Py.java) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java) at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter .java) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret er.java) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret er.java) at org.python.util.InteractiveConsole.push(InteractiveConsole.java) at org.python.util.InteractiveConsole.interact(InteractiveConsole.java) at org.python.util.jython.main(jython.java) java.lang.NullPointerException: java.lang.NullPointerException |
|||
msg379 (view) | Author: Finn Bock (bckfnn) | Date: 2001-08-11.10:28:44 | |
Logged In: YES user_id=4201 Added as test316 |
|||
msg380 (view) | Author: Finn Bock (bckfnn) | Date: 2001-08-11.10:41:13 | |
Logged In: YES user_id=4201 Fixed in PyInstance.java: 2.23; Raises a KeyError on index failure. That matches what jython-2.0 did. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2001-08-08 22:47:57 | xoltar | create |
Supported by Python Software Foundation,
Powered by Roundup