From: <no...@so...> - 2001-10-30 19:01:34
|
Bugs item #462280, was opened at 2001-09-17 10:01 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=462280&group_id=12867 Category: Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Finn Bock (bckfnn) Summary: builtin method as a class variable Initial Comment: This has a simple test case, but I'm not sure that the solution is simple. This particular case is in the context of a list object, but it is possible that other objects suffer from the same problem. Jython 2.1a3 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> class Foo: ... mylistIndex = ['a', 'b', 'c', 'd', 'e'].index ... >>> a = Foo() >>> a.mylistIndex <builtin method 'index'> >>> a.mylistIndex('c') Traceback (innermost last): File "<console>", line 1, in ? TypeError: index(): expected 1 args; got 2 >>> >>> Foo.mylistIndex('c') Traceback (innermost last): File "<console>", line 1, in ? java.lang.NullPointerException at org.python.core.ListFunctions.__call__ (PyList.java) at org.python.core.PyObject.invoke (PyObject.java) at org.python.pycode._pyx2.f$0(<console>:1) at org.python.pycode._pyx2.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 For reference, CPython doesn't choke on this: Python 2.1 (#1, Apr 17 2001, 09:45:01) [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01 Type "copyright", "credits" or "license" for more information. >>> class Foo: ... mylistIndex = ['a', 'b', 'c', 'd', 'e'].index ... >>> a = Foo() >>> a.mylistIndex <built-in method index of list object at 0xa04da34> >>> a.mylistIndex('c') 2 >>> ---------------------------------------------------------------------- >Comment By: Finn Bock (bckfnn) Date: 2001-10-30 11:01 Message: Logged In: YES user_id=4201 Added as test328.py ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=462280&group_id=12867 |