@@ -1565,16 +1565,6 @@ trace_function_exit(PyThreadState *tstate, _PyInterpreterFrame *frame, PyObject
1565
1565
return 0 ;
1566
1566
}
1567
1567
1568
- static int
1569
- skip_backwards_over_extended_args (PyCodeObject * code , int offset )
1570
- {
1571
- _Py_CODEUNIT * instrs = (_Py_CODEUNIT * )PyBytes_AS_STRING (code -> co_code );
1572
- while (offset > 0 && _Py_OPCODE (instrs [offset - 1 ]) == EXTENDED_ARG ) {
1573
- offset -- ;
1574
- }
1575
- return offset ;
1576
- }
1577
-
1578
1568
static _PyInterpreterFrame *
1579
1569
pop_frame (PyThreadState * tstate , _PyInterpreterFrame * frame )
1580
1570
{
@@ -5445,7 +5435,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
5445
5435
#endif
5446
5436
{
5447
5437
if (tstate -> tracing == 0 ) {
5448
- int instr_prev = skip_backwards_over_extended_args ( frame -> f_code , frame -> f_lasti ) ;
5438
+ int instr_prev = frame -> f_lasti ;
5449
5439
frame -> f_lasti = INSTR_OFFSET ();
5450
5440
TRACING_NEXTOPARG ();
5451
5441
if (opcode == RESUME ) {
@@ -6737,9 +6727,13 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
6737
6727
then call the trace function if we're tracing source lines.
6738
6728
*/
6739
6729
initialize_trace_info (& tstate -> trace_info , frame );
6740
- _Py_CODEUNIT prev = ((_Py_CODEUNIT * )PyBytes_AS_STRING (frame -> f_code -> co_code ))[instr_prev ];
6730
+ int entry_point = 0 ;
6731
+ _Py_CODEUNIT * code = (_Py_CODEUNIT * )PyBytes_AS_STRING (frame -> f_code -> co_code );
6732
+ while (_Py_OPCODE (code [entry_point ]) != RESUME ) {
6733
+ entry_point ++ ;
6734
+ }
6741
6735
int lastline ;
6742
- if (_Py_OPCODE ( prev ) == RESUME && _Py_OPARG ( prev ) == 0 ) {
6736
+ if (instr_prev <= entry_point ) {
6743
6737
lastline = -1 ;
6744
6738
}
6745
6739
else {
0 commit comments