[pypy-dev] Re: stdobjspace status

Armin Rigo arigo at tunes.org
Thu Feb 27 14:52:36 CET 2003


Hello Michael,

On Tue, Feb 25, 2003 at 02:04:51PM +0000, Michael Hudson wrote:
> (...END_FINALLY...)
> 
> Is this the problem that we sometimes push interpreter level objects
> onto the applications's stack?  I'm not sure we have much freedom here
> unless we fiddle the compiled bytecodes.  But I'm still a little fuzzy
> on the issues.

I think I came up with a reasonable solution.  If you read the Python docs on
sys.exc_info() (http://www.python.org/doc/current/lib/module-sys.html#l2h-246)  
you see a description that makes natural the introduction of a new stack, the
"exception stack", of which sys.exc_info() would return the top-most item.  
Then I think that we can use this execution-context-global (not
frame-dependent) stack to store the current exceptions.  The END_FINALLY
opcode can work by inspecting this stack to know if there is an exception to
restore or not.

It is also cleaner than both CPython, which abuses the valuestack to store the exception 
stuff, and the current pypy, were we abuse the blockstack for this purpose.


A bientôt,

Armin.


More information about the Pypy-dev mailing list