tests/basics/try_finally: Fix try/finally flow tests under CPython 3.14.

This commit fixes tests that will always fail when using CPython 3.14
to get a known-good output to compare MicroPython's behaviour against.

Starting from CPython 3.14, statements inside a `finally` block that
will prevent the execution flow to reach the block's last statement will
raise a SyntaxWarning.  That text would end up in the comparison data
and thus make known-good tests fail.

Given that those tests explicitly exercise flow control interruptions
in finally blocks, there is no real workaround that can be applied to
the tests themselves.  Therefore those tests will now check
MicroPython's behaviour against expected output files recorded from
the tests' output with CPython 3.11.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2026-01-12 13:44:37 +01:00
parent 230bbbbdf5
commit e66a1a3f4a
7 changed files with 134 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
1
2
5
a 1
1
iter 0
1
None
1
2
None
1
2
None
1
3
4
7
1
2
4
7
1
4
7

View File

@@ -0,0 +1,17 @@
4 0 0 1
4 0 0 2
4 0 0 3
4 0 0 4
4 1 0 1
4 1 0 2
4 1 0 3
4 1 0 4
4 2 0 1
4 2 0 2
4 2 0 3
4 2 0 4
4 3 0 1
4 3 0 2
4 3 0 3
4 3 0 4
None

View File

@@ -0,0 +1,9 @@
4 0
continue
4 1
continue
4 2
continue
4 3
continue
None

View File

@@ -0,0 +1,19 @@
finally
0
finally 1
finally 2
2
finally 1
finally 2
1
finally 1
finally 2
2
finally
0
finally
0
finally
0
finally
0

View File

@@ -0,0 +1,23 @@
1
42
1
2
42
1
2
3
42
2
1
42
2
1
42
1
3
2
42
1
3
2
42

View File

@@ -0,0 +1,38 @@
1
2
3
4
5
None
1
2
3
5
42
1
2
5
43
1
2
5
43
1
2
5
caught
1
2
5
caught
1
2
3
4
5
None
1
2
3
5
42

View File

@@ -0,0 +1,3 @@
4 0
return
43