summaryrefslogtreecommitdiff
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-02-22 23:33:30 +0200
committerGitHub <noreply@github.com>2018-02-22 23:33:30 +0200
commit520b7ae27e39d1c77ea74ccd1b184d7cb43f9dcb (patch)
tree8a661515a3574b0d79ea2024a3b92646dd7ee837 /Lib/test/test_sys_settrace.py
parent4af8fd561433826ac897c55e41a087a5c5dbacf3 (diff)
downloadcpython-git-520b7ae27e39d1c77ea74ccd1b184d7cb43f9dcb.tar.gz
bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter to compiler. (GH-5006)
Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py58
1 files changed, 41 insertions, 17 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index e6eb80ad86..7df10cb5c1 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -187,7 +187,6 @@ tightloop_example.events = [(0, 'call'),
(1, 'line'),
(2, 'line'),
(3, 'line'),
- (4, 'line'),
(5, 'line'),
(5, 'line'),
(5, 'line'),
@@ -715,6 +714,21 @@ class JumpTestCase(unittest.TestCase):
output.append(11)
output.append(12)
+ @jump_test(5, 11, [2, 4, 12])
+ def test_jump_over_return_try_finally_in_finally_block(output):
+ try:
+ output.append(2)
+ finally:
+ output.append(4)
+ output.append(5)
+ return
+ try:
+ output.append(8)
+ finally:
+ output.append(10)
+ pass
+ output.append(12)
+
@jump_test(3, 4, [1, 4])
def test_jump_infinite_while_loop(output):
output.append(1)
@@ -722,6 +736,22 @@ class JumpTestCase(unittest.TestCase):
output.append(3)
output.append(4)
+ @jump_test(2, 4, [4, 4])
+ def test_jump_forwards_into_while_block(output):
+ i = 1
+ output.append(2)
+ while i <= 2:
+ output.append(4)
+ i += 1
+
+ @jump_test(5, 3, [3, 3, 3, 5])
+ def test_jump_backwards_into_while_block(output):
+ i = 1
+ while i <= 2:
+ output.append(3)
+ i += 1
+ output.append(5)
+
@jump_test(2, 3, [1, 3])
def test_jump_forwards_out_of_with_block(output):
with tracecontext(output, 1):
@@ -916,22 +946,6 @@ class JumpTestCase(unittest.TestCase):
output.append(2)
output.append(3)
- @jump_test(2, 4, [], (ValueError, 'into'))
- def test_no_jump_forwards_into_while_block(output):
- i = 1
- output.append(2)
- while i <= 2:
- output.append(4)
- i += 1
-
- @jump_test(5, 3, [3, 3], (ValueError, 'into'))
- def test_no_jump_backwards_into_while_block(output):
- i = 1
- while i <= 2:
- output.append(3)
- i += 1
- output.append(5)
-
@jump_test(1, 3, [], (ValueError, 'into'))
def test_no_jump_forwards_into_with_block(output):
output.append(1)
@@ -1024,6 +1038,16 @@ class JumpTestCase(unittest.TestCase):
with tracecontext(output, 4):
output.append(5)
+ @jump_test(5, 7, [2, 4], (ValueError, 'finally'))
+ def test_no_jump_over_return_out_of_finally_block(output):
+ try:
+ output.append(2)
+ finally:
+ output.append(4)
+ output.append(5)
+ return
+ output.append(7)
+
@jump_test(7, 4, [1, 6], (ValueError, 'into'))
def test_no_jump_into_for_block_before_else(output):
output.append(1)