mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
GH-96864: Check for error between line and opcode events (GH-96880)
This commit is contained in:
parent
5b3a2569f4
commit
c10e33ac11
3 changed files with 17 additions and 1 deletions
|
@ -1721,6 +1721,20 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
|
|||
finally:
|
||||
sys.settrace(existing)
|
||||
|
||||
def test_line_event_raises_before_opcode_event(self):
|
||||
exception = ValueError("BOOM!")
|
||||
def trace(frame, event, arg):
|
||||
if event == "line":
|
||||
raise exception
|
||||
frame.f_trace_opcodes = True
|
||||
return trace
|
||||
def f():
|
||||
pass
|
||||
with self.assertRaises(ValueError) as caught:
|
||||
sys.settrace(trace)
|
||||
f()
|
||||
self.assertIs(caught.exception, exception)
|
||||
|
||||
|
||||
# 'Jump' tests: assigning to frame.f_lineno within a trace function
|
||||
# moves the execution position - it's how debuggers implement a Jump
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue