Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7bcf4d

Browse files
committed
Fixed a comment and added another one.
1 parent effb393 commit d7bcf4d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Python/compile.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names, PyObject *linen
651651
"if a and b:"
652652
"if a or b:"
653653
"a and b or c"
654-
"a and b and c"
654+
"(a and b) and c"
655655
x:JUMP_IF_FALSE y y:JUMP_IF_FALSE z --> x:JUMP_IF_FALSE z
656656
x:JUMP_IF_FALSE y y:JUMP_IF_TRUE z --> x:JUMP_IF_FALSE y+3
657657
where y+3 is the instruction following the second test.
@@ -749,6 +749,9 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names, PyObject *linen
749749
while (adj--)
750750
codestr[h++] = codestr[i++];
751751
}
752+
/* The following assertion detects the presence of NOPs in the input
753+
bytecode. The compiler never produces NOPs so far; if one day it
754+
does, the way 'nops' is counted above must be changed. */
752755
assert(h + nops == codelen);
753756

754757
code = PyString_FromStringAndSize((char *)codestr, h);

0 commit comments

Comments
 (0)