[Python-Dev] PyEval_GetFrame() revisited

Christian Tismer tismer@tismer.com
Fri, 14 Mar 2003 17:35:56 +0100

Hi there!

here has been this patch to the threadstate, which
allows to override the tstate's frame access.

I just saw the part of the patch that modifies

       f = PyFrame_New(
                       tstate,			/*back*/
                       c,				/*code*/
!                     PyEval_GetGlobals(),	/*globals*/
                       NULL			/*locals*/

where the PyEval_GetGLobals is used instead of

Well, this unfortunately is not sufficient
for this module, since pyexpat still *has* direct
access to tstate->frame, in a much worse way:
pyexpat does read and write the frame variable!

In line 326, function call_with_frame, pyexpat
creates a new frame, assigns it to tstate->frame
and later on assigns f_f_back to it.

Reason why I'm thinking about this:
In order to simplify Stackless, I thought to remove
the frame variable, and let it be accessed always
via my current tasklet, which holds the frame.

Looking for the number of necessary patches, I stumbled
over PyExpat, and thought I should better keep my
hands off. Too bad.

Does it make sense to think about an API for
modifying the frame? Or are we at a dead end here?

cheers - chris
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/