diff options
| author | Benjamin Peterson <benjamin@python.org> | 2012-04-18 11:14:31 -0400 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2012-04-18 11:14:31 -0400 |
| commit | e42fb307edbdc8bb98fa5d43646cbbe33f307501 (patch) | |
| tree | 1d23b730927815b1ccb16b0b2e59b20858397a18 /Lib/test/test_sys_settrace.py | |
| parent | 32c59b6fc1140486a9915876054365b40bd88da9 (diff) | |
| download | cpython-git-e42fb307edbdc8bb98fa5d43646cbbe33f307501.tar.gz | |
SETUP_WITH acts like SETUP_FINALLY for the purposes of setting f_lineno (closes #14612)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
| -rw-r--r-- | Lib/test/test_sys_settrace.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index cf3976c55b..ea2bb2987a 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 = {} |
