summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-04-18 15:14:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-04-18 15:14:31 (GMT)
commite42fb307edbdc8bb98fa5d43646cbbe33f307501 (patch)
tree1d23b730927815b1ccb16b0b2e59b20858397a18 /Lib
parent32c59b6fc1140486a9915876054365b40bd88da9 (diff)
downloadcpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.zip
cpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.tar.gz
cpython-e42fb307edbdc8bb98fa5d43646cbbe33f307501.tar.bz2
SETUP_WITH acts like SETUP_FINALLY for the purposes of setting f_lineno (closes #14612)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_sys_settrace.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index cf3976c..ea2bb29 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -671,6 +671,14 @@ def no_jump_to_non_integers(output):
no_jump_to_non_integers.jump = (2, "Spam")
no_jump_to_non_integers.output = [True]
+def jump_across_with(output):
+ with open(support.TESTFN, "wb") as fp:
+ pass
+ with open(support.TESTFN, "wb") as fp:
+ pass
+jump_across_with.jump = (1, 3)
+jump_across_with.output = []
+
# This verifies that you can't set f_lineno via _getframe or similar
# trickery.
def no_jump_without_trace_function():
@@ -740,6 +748,9 @@ class JumpTestCase(unittest.TestCase):
self.run_test(no_jump_to_non_integers)
def test_19_no_jump_without_trace_function(self):
no_jump_without_trace_function()
+ def test_jump_across_with(self):
+ self.addCleanup(support.unlink, support.TESTFN)
+ self.run_test(jump_across_with)
def test_20_large_function(self):
d = {}