|
From: Samuele P. <pe...@in...> - 2001-09-17 16:41:25
|
Yes, it's a bug. Don't how complex is to fix, in any case is from a part of JPython that we haven't touched and which is quite fragile. Please submit a bug report to SF, if you haven't do so yet. Thanks, Samuele Pedroni. > From: "Kevin Dangoor" <kda...@we...> > To: <jyt...@li...> > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > X-Priority: 3 > X-MSMail-Priority: Normal > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 > Subject: [Jython-dev] bug: calling a builtin method as a class variable > X-BeenThere: jyt...@li... > X-Mailman-Version: 2.0.5 > List-Help: <mailto:jyt...@li...?subject=help> > List-Post: <mailto:jyt...@li...> > List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/jython-dev>, <mailto:jyt...@li...?subject=subscribe> > List-Id: <jython-dev.lists.sourceforge.net> > List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/jython-dev>, <mailto:jyt...@li...?subject=unsubscribe> > List-Archive: <https://lists.sourceforge.net/archives//jython-dev/> > X-Original-Date: Mon, 17 Sep 2001 12:08:55 -0400 > Date: Mon, 17 Sep 2001 12:08:55 -0400 > > This has a simple test case, but I'm not sure that the solution is simple. > > 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 > >>> > > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev |