Skip to content

Commit 38e04b5

Browse files
committed
DRY stats call.
1 parent 5fdd7f8 commit 38e04b5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Include/internal/pycore_frame.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extern "C" {
66

77
#include <stdbool.h>
88
#include <stddef.h>
9+
#include "pycore_code.h" // STATS
910

1011
/* See Objects/frame_layout.md for an explanation of the frame stack
1112
* including explanation of the PyFrameObject and _PyInterpreterFrame
@@ -190,6 +191,7 @@ void _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame);
190191
static inline _PyInterpreterFrame *
191192
_PyFrame_PushUnchecked(PyThreadState *tstate, PyFunctionObject *func)
192193
{
194+
CALL_STAT_INC(frames_pushed);
193195
PyCodeObject *code = (PyCodeObject *)func->func_code;
194196
_PyInterpreterFrame *new_frame = (_PyInterpreterFrame *)tstate->datastack_top;
195197
tstate->datastack_top += code->co_framesize;

Python/ceval.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
22442244
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), BINARY_SUBSCR);
22452245
Py_INCREF(getitem);
22462246
_PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, getitem);
2247-
CALL_STAT_INC(frames_pushed);
22482247
CALL_STAT_INC(inlined_py_calls);
22492248
STACK_SHRINK(2);
22502249
new_frame->localsplus[0] = container;
@@ -4773,7 +4772,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
47734772
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
47744773
STAT_INC(CALL, hit);
47754774
_PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, func);
4776-
CALL_STAT_INC(frames_pushed);
47774775
CALL_STAT_INC(inlined_py_calls);
47784776
STACK_SHRINK(argcount);
47794777
for (int i = 0; i < argcount; i++) {
@@ -4808,7 +4806,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
48084806
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize), CALL);
48094807
STAT_INC(CALL, hit);
48104808
_PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, func);
4811-
CALL_STAT_INC(frames_pushed);
48124809
CALL_STAT_INC(inlined_py_calls);
48134810
STACK_SHRINK(argcount);
48144811
for (int i = 0; i < argcount; i++) {

0 commit comments

Comments
 (0)