summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-10 03:55:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-04-10 03:55:56 (GMT)
commitd51374ed78a3e3145911a16cdf3b9b84b3ba7d15 (patch)
tree31f9086f20f5b8923604f41f1a4d139fa809aaed /Python/ceval.c
parent2aad6ef77419887f5875ba942e9369b4bdd34a5e (diff)
downloadcpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.zip
cpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.tar.gz
cpython-d51374ed78a3e3145911a16cdf3b9b84b3ba7d15.tar.bz2
PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 5db88be..ab7afa9 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1495,6 +1495,18 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
DISPATCH();
}
+ TARGET(BINARY_MATRIX_MULTIPLY) {
+ PyObject *right = POP();
+ PyObject *left = TOP();
+ PyObject *res = PyNumber_MatrixMultiply(left, right);
+ Py_DECREF(left);
+ Py_DECREF(right);
+ SET_TOP(res);
+ if (res == NULL)
+ goto error;
+ DISPATCH();
+ }
+
TARGET(BINARY_TRUE_DIVIDE) {
PyObject *divisor = POP();
PyObject *dividend = TOP();
@@ -1685,6 +1697,18 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
DISPATCH();
}
+ TARGET(INPLACE_MATRIX_MULTIPLY) {
+ PyObject *right = POP();
+ PyObject *left = TOP();
+ PyObject *res = PyNumber_InPlaceMatrixMultiply(left, right);
+ Py_DECREF(left);
+ Py_DECREF(right);
+ SET_TOP(res);
+ if (res == NULL)
+ goto error;
+ DISPATCH();
+ }
+
TARGET(INPLACE_TRUE_DIVIDE) {
PyObject *divisor = POP();
PyObject *dividend = TOP();