summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-06-21 14:40:54 (GMT)
committerGitHub <noreply@github.com>2022-06-21 14:40:54 (GMT)
commit6f8875eba38b08c802905635759b5f905e3a415c (patch)
tree6ee112e6f2e61ccbde70f9bf4bc5f103c0e12508 /Python/ceval.c
parentc7a79bb036b42f96b7379b95efa643ee27df2168 (diff)
downloadcpython-6f8875eba38b08c802905635759b5f905e3a415c.zip
cpython-6f8875eba38b08c802905635759b5f905e3a415c.tar.gz
cpython-6f8875eba38b08c802905635759b5f905e3a415c.tar.bz2
GH-93841: Allow stats to be turned on and off, cleared and dumped at runtime. (GH-93843)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index bdae333..47dd100 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1310,7 +1310,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
do { \
frame->prev_instr = next_instr++; \
OPCODE_EXE_INC(op); \
- _py_stats.opcode_stats[lastopcode].pair_count[op]++; \
+ if (_py_stats) _py_stats->opcode_stats[lastopcode].pair_count[op]++; \
lastopcode = op; \
} while (0)
#else
@@ -7790,7 +7790,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
PyObject *l = PyList_New(257);
if (l == NULL) return NULL;
for (i = 0; i < 256; i++) {
- PyObject *x = getarray(_py_stats.opcode_stats[i].pair_count);
+ PyObject *x = getarray(_py_stats_struct.opcode_stats[i].pair_count);
if (x == NULL) {
Py_DECREF(l);
return NULL;
@@ -7804,7 +7804,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
}
for (i = 0; i < 256; i++) {
PyObject *x = PyLong_FromUnsignedLongLong(
- _py_stats.opcode_stats[i].execution_count);
+ _py_stats_struct.opcode_stats[i].execution_count);
if (x == NULL) {
Py_DECREF(counts);
Py_DECREF(l);