From: <bc...@wo...> - 2001-05-22 09:14:34
|
[Samuele] >Update of /cvsroot/jython/jython/org/python/core >In directory usw-pr-cvs1:/tmp/cvs-serv2169/core > >Modified Files: > Py.java PyFrame.java PyTableCode.java parser.java >Log Message: >- fixed bug #415963 UnboundLocalError not raised on delete . >- fixed bug related to free+bound vars in class scope . >- incresead CPython compatibility: > * code supports co_nlocals, co_flags have CO_OPTIMIZED set when > meaningful > * def f(): > locals()['a']=1 > print a > now raises a NameError (like in CPython) > * co_varnames == () and co_nlocals = 0 for classdef code >! Py.newCode and related funcs signatures have been changed >- PyFrame.getf_locals() now deals with cell and free vars > and handles the classdef case >- compiler tiny mods for use by jythonc nested scopes support The recent set of checkins causes a NPE like this: >>> from java.lang import Thread >>> >>> class TestThread(Thread): ... def run(self): ... for i in range(100): ... exec("x=2+2") ... >>> t = TestThread() >>> t.start() >>> java.lang.NullPointerException at java.lang.System.arraycopy(Native Method) at org.python.core.PyTableCode.call(PyTableCode.java:320) at org.python.core.PyTableCode.call(PyTableCode.java:297) at org.python.core.PyFunction.__call__(PyFunction.java:185) at org.python.core.PyMethod.__call__(PyMethod.java:96) at org.python.core.PyObject.__call__(PyObject.java:252) at org.python.core.PyObject._jcallexc(PyObject.java:1957) at org.python.core.PyObject._jcall(PyObject.java:1989) at org.python.proxies.__main__$TestThread$0.run(Unknown Source) This appears to fix it, but could you verify that is look OK. --- PyTableCode.java.org Tue May 22 07:28:42 2001 +++ PyTableCode.java Tue May 22 08:15:45 2001 @@ -316,7 +316,7 @@ plain_args = co_argcount; actual_args = my_frame.f_fastlocals; - if (plain_args > 0) + if (plain_args > 0 && actual_args != null) System.arraycopy(call_args, 0, actual_args, 0, plain_args); if (!((call_keywords == null || call_keywords.length == 0) && The changes also cause a NPE when running this jythonc'ed code: def makedict(list): return {} makedict([ "FAILURE", ]) java.lang.NullPointerException at org.python.core.PyTableCode.call(PyTableCode.java:261) at org.python.core.PyFunction.__call__(PyFunction.java:170) at x$_PyInner.main$2(x.java:45) at x$_PyInner.call_function(x.java:32) at org.python.core.PyTableCode.call(PyTableCode.java:207) at org.python.core.PyCode.call(PyCode.java:13) at org.python.core.imp.createFromCode(imp.java:165) at org.python.core.Py.runMain(Py.java:818) at x.main(x.java:59) Again it seems to be related to the CO_OPTIMIZED/f_fastlocals but I can't see an immediate fix for this problem. regards, finn |