diff --git a/Python/ceval.c b/Python/ceval.c index 02e4e7b9e4d54f..ae1d7c7c9c81dc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -7454,7 +7454,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args) int i; PyObject *l = PyList_New(257); if (l == NULL) return NULL; - for (i = 0; i < 257; i++) { + for (i = 0; i < 256; i++) { PyObject *x = getarray(_py_stats.opcode_stats[i].pair_count); if (x == NULL) { Py_DECREF(l); @@ -7462,6 +7462,22 @@ _Py_GetDXProfile(PyObject *self, PyObject *args) } PyList_SET_ITEM(l, i, x); } + PyObject *counts = PyList_New(256); + if (counts == NULL) { + Py_DECREF(l); + return NULL; + } + for (i = 0; i < 256; i++) { + PyObject *x = PyLong_FromUnsignedLongLong( + _py_stats.opcode_stats[i].execution_count); + if (x == NULL) { + Py_DECREF(counts); + Py_DECREF(l); + return NULL; + } + PyList_SET_ITEM(counts, i, x); + } + PyList_SET_ITEM(l, 256, counts); return l; }