Skip to content

Commit 0e1fb4d

Browse files
committed
fix: revert an illusory performance gain that broke debuggers. #1420
1 parent f8f3edc commit 0e1fb4d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ Unreleased
2727
constructs) could cause incorrect claims of missing branches with the
2828
sys.monitoring core, as described in `issue 2070`_. This is now fixed.
2929

30+
- Fix: when running in pytest under coverage, a ``breakpoint()`` would stop in
31+
the wrong frame, one level down from where it should, as described in `issue
32+
1420`_. This was due to a coverage change in v6.4.1 that seemed to give a
33+
slight performance improvement, but I couldn't reproduce the performance
34+
gain, so it's been reverted, fixing the debugger problem.
35+
3036
- Split ``sqlite`` debugging information out of the ``sys`` :ref:`coverage
3137
debug <cmd_debug>` and :ref:`cmd_run_debug` options since it's bulky and not
3238
very useful.
3339

40+
.. _issue 1420: https://github.com/nedbat/coveragepy/issues/1420
3441
.. _issue 2070: https://github.com/nedbat/coveragepy/issues/2070
3542

3643

coverage/ctracer/tracer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame)
545545
Py_XDECREF(self->pcur_entry->file_data);
546546
self->pcur_entry->file_data = NULL;
547547
self->pcur_entry->file_tracer = Py_None;
548-
MyFrame_NoTraceLines(frame);
549548
SHOWLOG(PyFrame_GetLineNumber(frame), filename, "skipped");
550549
}
551550

coverage/ctracer/util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
#endif
3434

3535
#if PY_VERSION_HEX >= 0x030D0000
36-
#define MyFrame_NoTraceLines(f) (PyObject_SetAttrString((PyObject*)(f), "f_trace_lines", Py_False))
3736
#define MyFrame_SetTrace(f, obj) (PyObject_SetAttrString((PyObject*)(f), "f_trace", (PyObject*)(obj)))
3837
#else
39-
#define MyFrame_NoTraceLines(f) ((f)->f_trace_lines = 0)
4038
#define MyFrame_SetTrace(f, obj) {Py_INCREF(obj); Py_XSETREF((f)->f_trace, (PyObject*)(obj));}
4139
#endif
4240

0 commit comments

Comments
 (0)