Skip to content

Commit 17b3e16

Browse files
committed
Mark a few more functions as escaping
1 parent d09e18b commit 17b3e16

File tree

9 files changed

+32
-21
lines changed

9 files changed

+32
-21
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,7 @@ _Py_Dealloc(PyObject *op)
29872987
destructor dealloc = type->tp_dealloc;
29882988
#ifdef Py_DEBUG
29892989
PyThreadState *tstate = _PyThreadState_GET();
2990+
assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL);
29902991
PyObject *old_exc = tstate != NULL ? tstate->current_exception : NULL;
29912992
// Keep the old exception type alive to prevent undefined behavior
29922993
// on (tstate->curexc_type != old_exc_type) below

Python/bytecodes.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ dummy_func(
716716
// At the end we just skip over the STORE_FAST.
717717
op(_BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
718718
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
719-
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
719+
PyObject *right_o = PyStackRef_AsPyObjectSteal(right);
720720
assert(PyUnicode_CheckExact(left_o));
721721
assert(PyUnicode_CheckExact(right_o));
722722

@@ -747,8 +747,7 @@ dummy_func(
747747
PyObject *temp = PyStackRef_AsPyObjectSteal(*target_local);
748748
PyUnicode_Append(&temp, right_o);
749749
*target_local = PyStackRef_FromPyObjectSteal(temp);
750-
PyStackRef_CLOSE_SPECIALIZED(right, _PyUnicode_ExactDealloc);
751-
DEAD(right);
750+
Py_DECREF(right_o);
752751
ERROR_IF(PyStackRef_IsNull(*target_local), error);
753752
#if TIER_ONE
754753
// The STORE_FAST is already done. This is done here in tier one,

Python/ceval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
static void
141141
dump_stack(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer)
142142
{
143+
_PyFrame_SetStackPointer(frame, stack_pointer);
143144
_PyStackRef *stack_base = _PyFrame_Stackbase(frame);
144145
PyObject *exc = PyErr_GetRaisedException();
145146
printf(" stack=[");
@@ -170,6 +171,7 @@ dump_stack(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer)
170171
printf("]\n");
171172
fflush(stdout);
172173
PyErr_SetRaisedException(exc);
174+
_PyFrame_GetStackPointer(frame);
173175
}
174176

175177
static void

Python/ceval_macros.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@
8989
#if LLTRACE
9090
#define LLTRACE_RESUME_FRAME() \
9191
do { \
92+
_PyFrame_SetStackPointer(frame, stack_pointer); \
9293
int lltrace = maybe_lltrace_resume_frame(frame, GLOBALS()); \
94+
stack_pointer = _PyFrame_GetStackPointer(frame); \
9395
frame->lltrace = lltrace; \
9496
if (lltrace < 0) { \
9597
goto exit_unwind; \

Python/executor_cases.c.h

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/analyzer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
602602
"PyTuple_GET_ITEM",
603603
"PyTuple_GET_SIZE",
604604
"PyType_HasFeature",
605-
"PyUnicode_Append",
606605
"PyUnicode_Concat",
607606
"PyUnicode_GET_LENGTH",
608607
"PyUnicode_READ_CHAR",
@@ -619,7 +618,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
619618
"_PyCode_CODE",
620619
"_PyDictValues_AddToInsertionOrder",
621620
"_PyErr_Occurred",
622-
"_PyEval_FrameClearAndPop",
623621
"_PyFloat_FromDouble_ConsumeInputs",
624622
"_PyFrame_GetCode",
625623
"_PyFrame_IsIncomplete",
@@ -675,7 +673,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
675673
"assert",
676674
"backoff_counter_triggers",
677675
"initial_temperature_backoff_counter",
678-
"maybe_lltrace_resume_frame",
679676
"restart_backoff_counter",
680677
)
681678

0 commit comments

Comments
 (0)