From: <pj...@us...> - 2009-10-16 05:51:52
|
Revision: 6864 http://jython.svn.sourceforge.net/jython/?rev=6864&view=rev Author: pjenvey Date: 2009-10-16 05:51:46 +0000 (Fri, 16 Oct 2009) Log Message: ----------- The GC thread should be able to safely create GeneratorExits now that PyExceptions no longer create tracebacks when constructed (and so don't immediately need a frame on hand). this speeds up generator construction Modified Paths: -------------- trunk/jython/src/org/python/core/PyGenerator.java Modified: trunk/jython/src/org/python/core/PyGenerator.java =================================================================== --- trunk/jython/src/org/python/core/PyGenerator.java 2009-10-16 03:34:01 UTC (rev 6863) +++ trunk/jython/src/org/python/core/PyGenerator.java 2009-10-16 05:51:46 UTC (rev 6864) @@ -16,19 +16,12 @@ @ExposedGet protected boolean gi_running; - private PyException generatorExit; - private PyObject closure; public PyGenerator(PyFrame frame, PyObject closure) { super(TYPE); gi_frame = frame; this.closure = closure; - - // Create an exception instance while we have a frame to create it from. When the GC runs it - // doesn't have any associated thread state. this is necessary for finalize calling close on - // the generator - generatorExit = Py.makeException(Py.GeneratorExit); } public PyObject send(PyObject value) { @@ -68,7 +61,7 @@ @ExposedMethod final PyObject generator_close() { try { - raiseException(generatorExit); + raiseException(Py.makeException(Py.GeneratorExit)); throw Py.RuntimeError("generator ignored GeneratorExit"); } catch (PyException e) { if (!(e.type == Py.StopIteration || e.type == Py.GeneratorExit)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |