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):
9191 import threading
9292 start = threading .Barrier (2 , timeout = 20 )
9393
94- caught_ex = None
94+ caught_ex = "initial value of caught_ex"
9595 def other_thread ():
96+ nonlocal caught_ex
9697 try :
9798 start .wait () # ensure we are in the try, before raising
9899 r = 0
99100 for i in range (1 , 1000000000 ):
100101 for j in range (i , 1000000000 ):
101102 r += j / i
102103 except Exception as e :
103- nonlocal caught_ex
104104 caught_ex = e
105+ else :
106+ caught_ex = "no exception caught"
105107
106108
107109 t = threading .Thread (target = other_thread )
@@ -111,4 +113,4 @@ def other_thread():
111113 SetAsyncExcCaller .trigger_ex (t .ident , Exception ("test my message" ))
112114 t .join ()
113115
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