summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-11-23 20:10:25 -0600
committerBenjamin Peterson <benjamin@python.org>2014-11-23 20:10:25 -0600
commitc0e7bbf94ca6eba9dcb84d46f7ea145c623e81fe (patch)
tree5d24621d128569091d3199d4a17b8f410f3e5387 /Python/compile.c
parenta86af85bf732659baa385d860cc6ca8ff98a6f30 (diff)
parentf6f0dfea16bf8d43c011bec4783dd430e87b5830 (diff)
downloadcpython-c0e7bbf94ca6eba9dcb84d46f7ea145c623e81fe.tar.gz
merge 3.4 (null)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c
index ec7a4acd88..8abe50f4ca 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -30,8 +30,6 @@
#include "symtable.h"
#include "opcode.h"
-int Py_OptimizeFlag = 0;
-
#define DEFAULT_BLOCK_SIZE 16
#define DEFAULT_BLOCKS 8
#define DEFAULT_CODE_SIZE 128
@@ -881,6 +879,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
case BINARY_POWER:
case BINARY_MULTIPLY:
+ case BINARY_MATRIX_MULTIPLY:
case BINARY_MODULO:
case BINARY_ADD:
case BINARY_SUBTRACT:
@@ -895,6 +894,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
case INPLACE_ADD:
case INPLACE_SUBTRACT:
case INPLACE_MULTIPLY:
+ case INPLACE_MATRIX_MULTIPLY:
case INPLACE_MODULO:
return -1;
case STORE_SUBSCR:
@@ -1938,7 +1938,7 @@ compiler_if(struct compiler *c, stmt_ty s)
} else if (constant == 1) {
VISIT_SEQ(c, stmt, s->v.If.body);
} else {
- if (s->v.If.orelse) {
+ if (asdl_seq_LEN(s->v.If.orelse)) {
next = compiler_new_block(c);
if (next == NULL)
return 0;
@@ -1948,8 +1948,8 @@ compiler_if(struct compiler *c, stmt_ty s)
VISIT(c, expr, s->v.If.test);
ADDOP_JABS(c, POP_JUMP_IF_FALSE, next);
VISIT_SEQ(c, stmt, s->v.If.body);
- ADDOP_JREL(c, JUMP_FORWARD, end);
- if (s->v.If.orelse) {
+ if (asdl_seq_LEN(s->v.If.orelse)) {
+ ADDOP_JREL(c, JUMP_FORWARD, end);
compiler_use_next_block(c, next);
VISIT_SEQ(c, stmt, s->v.If.orelse);
}
@@ -2625,6 +2625,8 @@ binop(struct compiler *c, operator_ty op)
return BINARY_SUBTRACT;
case Mult:
return BINARY_MULTIPLY;
+ case MatMult:
+ return BINARY_MATRIX_MULTIPLY;
case Div:
return BINARY_TRUE_DIVIDE;
case Mod:
@@ -2689,6 +2691,8 @@ inplace_binop(struct compiler *c, operator_ty op)
return INPLACE_SUBTRACT;
case Mult:
return INPLACE_MULTIPLY;
+ case MatMult:
+ return INPLACE_MATRIX_MULTIPLY;
case Div:
return INPLACE_TRUE_DIVIDE;
case Mod: