summaryrefslogtreecommitdiffstats
path: root/Python/peephole.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-26 12:49:59 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-26 12:49:59 (GMT)
commitaafa18aa057cff3e47914c962437c922ece87beb (patch)
treee505c2c57f463449abc9b35c0ef4c00fe5052cc6 /Python/peephole.c
parent4ee8282229ec9b91f95f4c1f449bae85ee6941fe (diff)
downloadcpython-aafa18aa057cff3e47914c962437c922ece87beb.zip
cpython-aafa18aa057cff3e47914c962437c922ece87beb.tar.gz
cpython-aafa18aa057cff3e47914c962437c922ece87beb.tar.bz2
teach the peepholer about SETUP_WITH
Diffstat (limited to 'Python/peephole.c')
-rw-r--r--Python/peephole.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/peephole.c b/Python/peephole.c
index a3dda9c..13fc091 100644
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -259,6 +259,7 @@ markblocks(unsigned char *code, Py_ssize_t len)
case SETUP_LOOP:
case SETUP_EXCEPT:
case SETUP_FINALLY:
+ case SETUP_WITH:
j = GETJUMPTGT(code, i);
blocks[j] = 1;
break;
@@ -550,6 +551,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
case SETUP_LOOP:
case SETUP_EXCEPT:
case SETUP_FINALLY:
+ case SETUP_WITH:
tgt = GETJUMPTGT(codestr, i);
/* Replace JUMP_* to a RETURN into just a RETURN */
if (UNCONDITIONAL_JUMP(opcode) &&
@@ -628,6 +630,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
case SETUP_LOOP:
case SETUP_EXCEPT:
case SETUP_FINALLY:
+ case SETUP_WITH:
j = addrmap[GETARG(codestr, i) + i + 3] - addrmap[i] - 3;
SETARG(codestr, i, j);
break;