summaryrefslogtreecommitdiff
path: root/Lib/test/test_dis.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-16 13:07:01 +0000
committerGitHub <noreply@github.com>2020-12-16 13:07:01 +0000
commit5274b682bc93a04da8a69742528ac7f64633a96e (patch)
tree9b6cc57b7d1916555e44408d2f4295d94fa081a0 /Lib/test/test_dis.py
parentc71581c7a4192e6ba9a79eccc583aaadab300efa (diff)
downloadcpython-git-5274b682bc93a04da8a69742528ac7f64633a96e.tar.gz
bpo-42645: Make sure that return/break/continue are only traced once when exiting via a finally block. (GH-23780)
* Make sure that return/break/continue are only traced once when exiting via a finally block. * Add test for return in try-finally. * Update importlib
Diffstat (limited to 'Lib/test/test_dis.py')
-rw-r--r--Lib/test/test_dis.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index eb931703d5..f279f75c96 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -366,18 +366,14 @@ dis_tryfinally = """\
%3d 6 LOAD_FAST 1 (b)
8 CALL_FUNCTION 0
10 POP_TOP
-
-%3d 12 RETURN_VALUE
-
-%3d >> 14 LOAD_FAST 1 (b)
+ 12 RETURN_VALUE
+ >> 14 LOAD_FAST 1 (b)
16 CALL_FUNCTION 0
18 POP_TOP
20 RERAISE
""" % (_tryfinally.__code__.co_firstlineno + 1,
_tryfinally.__code__.co_firstlineno + 2,
_tryfinally.__code__.co_firstlineno + 4,
- _tryfinally.__code__.co_firstlineno + 2,
- _tryfinally.__code__.co_firstlineno + 4,
)
dis_tryfinallyconst = """\
@@ -388,19 +384,15 @@ dis_tryfinallyconst = """\
%3d 4 LOAD_FAST 0 (b)
6 CALL_FUNCTION 0
8 POP_TOP
-
-%3d 10 LOAD_CONST 1 (1)
+ 10 LOAD_CONST 1 (1)
12 RETURN_VALUE
-
-%3d >> 14 LOAD_FAST 0 (b)
+ >> 14 LOAD_FAST 0 (b)
16 CALL_FUNCTION 0
18 POP_TOP
20 RERAISE
""" % (_tryfinallyconst.__code__.co_firstlineno + 1,
_tryfinallyconst.__code__.co_firstlineno + 2,
_tryfinallyconst.__code__.co_firstlineno + 4,
- _tryfinallyconst.__code__.co_firstlineno + 2,
- _tryfinallyconst.__code__.co_firstlineno + 4,
)
def _g(x):