diff options
author | Thomas Wouters <thomas@python.org> | 2006-04-21 10:40:58 +0000 |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-04-21 10:40:58 +0000 |
commit | 49fd7fa4431da299196d74087df4a04f99f9c46f (patch) | |
tree | 35ace5fe78d3d52c7a9ab356ab9f6dbf8d4b71f4 /Lib/test/test_trace.py | |
parent | 9ada3d6e29d5165dadacbe6be07bcd35cfbef59d (diff) | |
download | cpython-git-49fd7fa4431da299196d74087df4a04f99f9c46f.tar.gz |
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html
Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:
test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec
This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r-- | Lib/test/test_trace.py | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 944ff9ac70..4f946f7b15 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -13,7 +13,15 @@ basic.events = [(0, 'call'), (1, 'line'), (1, 'return')] -# Armin Rigo's failing example: +# Many of the tests below are tricky because they involve pass statements. +# If there is implicit control flow around a pass statement (in an except +# clause or else caluse) under what conditions do you set a line number +# following that clause? + + +# The entire "while 0:" statement is optimized away. No code +# exists for it, so the line numbers skip directly from "del x" +# to "x = 1". def arigo_example(): x = 1 del x @@ -24,7 +32,6 @@ def arigo_example(): arigo_example.events = [(0, 'call'), (1, 'line'), (2, 'line'), - (3, 'line'), (5, 'line'), (5, 'return')] @@ -60,14 +67,16 @@ no_pop_tops.events = [(0, 'call'), (2, 'return')] def no_pop_blocks(): - while 0: + y = 1 + while not y: bla x = 1 no_pop_blocks.events = [(0, 'call'), (1, 'line'), - (3, 'line'), - (3, 'return')] + (2, 'line'), + (4, 'line'), + (4, 'return')] def called(): # line -3 x = 1 @@ -127,6 +136,13 @@ settrace_and_raise.events = [(2, 'exception'), (4, 'return')] # implicit return example +# This test is interesting because of the else: pass +# part of the code. The code generate for the true +# part of the if contains a jump past the else branch. +# The compiler then generates an implicit "return None" +# Internally, the compiler visits the pass statement +# and stores its line number for use on the next instruction. +# The next instruction is the implicit return None. def ireturn_example(): a = 5 b = 5 @@ -140,7 +156,8 @@ ireturn_example.events = [(0, 'call'), (2, 'line'), (3, 'line'), (4, 'line'), - (4, 'return')] + (6, 'line'), + (6, 'return')] # Tight loop with while(1) example (SF #765624) def tightloop_example(): @@ -221,14 +238,12 @@ class TraceTestCase(unittest.TestCase): def test_01_basic(self): self.run_test(basic) -## XXX: These tests fail with the new ast compiler. They must -## be fixed before a release. -## def test_02_arigo(self): -## self.run_test(arigo_example) + def test_02_arigo(self): + self.run_test(arigo_example) def test_03_one_instr(self): self.run_test(one_instr_line) -## def test_04_no_pop_blocks(self): -## self.run_test(no_pop_blocks) + def test_04_no_pop_blocks(self): + self.run_test(no_pop_blocks) ## def test_05_no_pop_tops(self): ## self.run_test(no_pop_tops) def test_06_call(self): @@ -240,8 +255,8 @@ class TraceTestCase(unittest.TestCase): self.run_test2(settrace_and_return) def test_09_settrace_and_raise(self): self.run_test2(settrace_and_raise) -## def test_10_ireturn(self): -## self.run_test(ireturn_example) + def test_10_ireturn(self): + self.run_test(ireturn_example) def test_11_tightloop(self): self.run_test(tightloop_example) def test_12_tighterloop(self): @@ -579,17 +594,14 @@ class JumpTestCase(unittest.TestCase): self.run_test(no_jump_too_far_forwards) def test_09_no_jump_too_far_backwards(self): self.run_test(no_jump_too_far_backwards) -# XXX: These tests cause the interpreter to crash. The frame_setlineno() -# function no longer works correctly because the lineno table generated by -# the AST compiler is slightly different than with the old compiler. -# def test_10_no_jump_to_except_1(self): -# self.run_test(no_jump_to_except_1) -# def test_11_no_jump_to_except_2(self): -# self.run_test(no_jump_to_except_2) -# def test_12_no_jump_to_except_3(self): -# self.run_test(no_jump_to_except_3) -# def test_13_no_jump_to_except_4(self): -# self.run_test(no_jump_to_except_4) + def test_10_no_jump_to_except_1(self): + self.run_test(no_jump_to_except_1) + def test_11_no_jump_to_except_2(self): + self.run_test(no_jump_to_except_2) + def test_12_no_jump_to_except_3(self): + self.run_test(no_jump_to_except_3) + def test_13_no_jump_to_except_4(self): + self.run_test(no_jump_to_except_4) def test_14_no_jump_forwards_into_block(self): self.run_test(no_jump_forwards_into_block) def test_15_no_jump_backwards_into_block(self): |