Patches item #1754094, was opened at 2007-07-14 16:38
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1754094&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Christopher Tur Lesniewski-Laas (ctl)
Assigned to: Nobody/Anonymous (nobody)
Summary: Tighter co_stacksize computation in stackdepth_walk

Initial Comment:
The existing code in stackdepth_walk gives conservative, but not very tight, 
bounds for stack depth.  Some of this is simply bugs: for example,
  import a,b,c,d,e,f,...,z
will leak a stack slot for each import, and
  a[:],b[:],c[:],...,z[:]
leaks a stack slot for each SLICE+0 opcode.

Some of it is because stackdepth_walk assumes that the stack effect of jumps is 
the same at the target.  In particular, a sequence of for-loops will leak 2 
stack slots for each for-loop.

The attached patch fixes both of these problems.  It corrects the stack effect 
for several opcodes that were simply incorrect (perhaps from an older 
version?).  It also changes stackdepth_walk to treat FOR_ITER, SETUP_EXCEPT, 
and SETUP_FINALLY specially when following their targets.

Note: this patch also introduces a dependency from stackdepth_walk to the 
compiler, because it assumes that END_FINALLY is always preceded by the target 
of a SETUP_EXCEPT or SETUP_FINALLY.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1754094&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to