summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 3c52c58..b4029d1 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2243,6 +2243,7 @@ handle_eval_breaker:
goto error;
}
CALL_STAT_INC(frames_pushed);
+ Py_INCREF(getitem);
_PyFrame_InitializeSpecials(new_frame, getitem,
NULL, code->co_nlocalsplus);
STACK_SHRINK(2);
@@ -2791,6 +2792,12 @@ handle_eval_breaker:
TARGET(UNPACK_SEQUENCE) {
PREDICTED(UNPACK_SEQUENCE);
PyObject *seq = POP(), *item, **items;
+#ifdef Py_STATS
+ extern int _PySpecialization_ClassifySequence(PyObject *);
+ _py_stats.opcode_stats[UNPACK_SEQUENCE].specialization.failure++;
+ _py_stats.opcode_stats[UNPACK_SEQUENCE].specialization.
+ failure_kinds[_PySpecialization_ClassifySequence(seq)]++;
+#endif
if (PyTuple_CheckExact(seq) &&
PyTuple_GET_SIZE(seq) == oparg) {
items = ((PyTupleObject *)seq)->ob_item;
@@ -4590,7 +4597,6 @@ handle_eval_breaker:
STACK_SHRINK(call_shape.postcall_shrink);
// The frame has stolen all the arguments from the stack,
// so there is no need to clean them up.
- Py_DECREF(function);
if (new_frame == NULL) {
goto error;
}
@@ -4675,7 +4681,6 @@ handle_eval_breaker:
new_frame->localsplus[i] = NULL;
}
STACK_SHRINK(call_shape.postcall_shrink);
- Py_DECREF(func);
_PyFrame_SetStackPointer(frame, stack_pointer);
new_frame->previous = frame;
frame = cframe.current_frame = new_frame;
@@ -4712,7 +4717,6 @@ handle_eval_breaker:
new_frame->localsplus[i] = NULL;
}
STACK_SHRINK(call_shape.postcall_shrink);
- Py_DECREF(func);
_PyFrame_SetStackPointer(frame, stack_pointer);
new_frame->previous = frame;
frame = cframe.current_frame = new_frame;
@@ -6077,7 +6081,7 @@ fail_post_args:
return -1;
}
-/* Consumes all the references to the args */
+/* Consumes references to func and all the args */
static InterpreterFrame *
_PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
PyObject *locals, PyObject* const* args,
@@ -6131,7 +6135,9 @@ _PyEval_Vector(PyThreadState *tstate, PyFunctionObject *func,
PyObject* const* args, size_t argcount,
PyObject *kwnames)
{
- /* _PyEvalFramePushAndInit consumes all the references to its arguments */
+ /* _PyEvalFramePushAndInit consumes the references
+ * to func and all its arguments */
+ Py_INCREF(func);
for (size_t i = 0; i < argcount; i++) {
Py_INCREF(args[i]);
}