File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
graalpython/com.oracle.graal.python.test/src/tests/cpyext Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -91,17 +91,19 @@ def test_SetAsyncExc(self):
91
91
import threading
92
92
start = threading .Barrier (2 , timeout = 20 )
93
93
94
- caught_ex = None
94
+ caught_ex = "initial value of caught_ex"
95
95
def other_thread ():
96
+ nonlocal caught_ex
96
97
try :
97
98
start .wait () # ensure we are in the try, before raising
98
99
r = 0
99
100
for i in range (1 , 1000000000 ):
100
101
for j in range (i , 1000000000 ):
101
102
r += j / i
102
103
except Exception as e :
103
- nonlocal caught_ex
104
104
caught_ex = e
105
+ else :
106
+ caught_ex = "no exception caught"
105
107
106
108
107
109
t = threading .Thread (target = other_thread )
@@ -111,4 +113,4 @@ def other_thread():
111
113
SetAsyncExcCaller .trigger_ex (t .ident , Exception ("test my message" ))
112
114
t .join ()
113
115
114
- assert "test my message" in str (caught_ex ), str (caught_ex )
116
+ assert "test my message" in str (caught_ex ), f" { str (caught_ex )= } , { t . is_alive () = } "
You can’t perform that action at this time.
0 commit comments