From: <zy...@us...> - 2009-02-14 10:44:19
|
Revision: 6027 http://jython.svn.sourceforge.net/jython/?rev=6027&view=rev Author: zyasoft Date: 2009-02-14 10:44:17 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Set the traceback when intercepting an exception. Set __doc__ strings for functions from the constant pool (if available). Modified Paths: -------------- branches/pbcvm/src/org/python/core/PyBytecode.java Modified: branches/pbcvm/src/org/python/core/PyBytecode.java =================================================================== --- branches/pbcvm/src/org/python/core/PyBytecode.java 2009-02-14 09:23:58 UTC (rev 6026) +++ branches/pbcvm/src/org/python/core/PyBytecode.java 2009-02-14 10:44:17 UTC (rev 6027) @@ -835,9 +835,11 @@ stack.push(new PyDictionary()); break; - case Opcode.LOAD_ATTR: - stack.push(stack.pop().__getattr__(co_names[oparg])); + case Opcode.LOAD_ATTR: { + String name = co_names[oparg]; + stack.push(stack.pop().__getattr__(name)); break; + } case Opcode.COMPARE_OP: { PyObject b = stack.pop(); @@ -1055,7 +1057,11 @@ case Opcode.MAKE_FUNCTION: { PyCode code = (PyCode) stack.pop(); PyObject[] defaults = stack.popN(oparg); - PyFunction func = new PyFunction(f.f_globals, defaults, code); + PyObject doc = null; + if (code instanceof PyBytecode && ((PyBytecode)code).co_consts.length > 0) { + doc = ((PyBytecode)code).co_consts[0]; + } + PyFunction func = new PyFunction(f.f_globals, defaults, code, doc); stack.push(func); break; } @@ -1093,7 +1099,7 @@ } // end switch } // end try catch (Throwable t) { - PyException pye = Py.JavaError(t); + PyException pye = Py.setException(t, f); why = Why.EXCEPTION; ts.exception = pye; if (debug) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |