summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2004-10-30 21:08:59 (GMT)
committerArmin Rigo <arigo@tunes.org>2004-10-30 21:08:59 (GMT)
commitd7bcf4deb174e5e5b6548eb64fe2b0735da5dc95 (patch)
treebb3568481cb2beb989c5641c73869d3388394590 /Python/compile.c
parenteffb3931ead28d47d240a113c85e8e494273ebfc (diff)
downloadcpython-d7bcf4deb174e5e5b6548eb64fe2b0735da5dc95.zip
cpython-d7bcf4deb174e5e5b6548eb64fe2b0735da5dc95.tar.gz
cpython-d7bcf4deb174e5e5b6548eb64fe2b0735da5dc95.tar.bz2
Fixed a comment and added another one.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 137b46d..f808307 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -651,7 +651,7 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names, PyObject *linen
"if a and b:"
"if a or b:"
"a and b or c"
- "a and b and c"
+ "(a and b) and c"
x:JUMP_IF_FALSE y y:JUMP_IF_FALSE z --> x:JUMP_IF_FALSE z
x:JUMP_IF_FALSE y y:JUMP_IF_TRUE z --> x:JUMP_IF_FALSE y+3
where y+3 is the instruction following the second test.
@@ -749,6 +749,9 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names, PyObject *linen
while (adj--)
codestr[h++] = codestr[i++];
}
+ /* The following assertion detects the presence of NOPs in the input
+ bytecode. The compiler never produces NOPs so far; if one day it
+ does, the way 'nops' is counted above must be changed. */
assert(h + nops == codelen);
code = PyString_FromStringAndSize((char *)codestr, h);