File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,13 @@ execution of THUNK as a string."
140
140
(bt :with-recursive-lock-held (with-python-count-lock)
141
141
(incf in-with-python-count)))
142
142
(pycall (format nil " sys.~A .write" stderr-or-stdout) " ." )
143
- (funcall thunk)
144
- (pycall (format nil " sys.~A .flush" stderr-or-stdout))
145
- (bt :signal-semaphore with-python-start-semaphore)
146
- (without-python-gil
147
- (bt :wait-on-semaphore with-python-end-semaphore))
148
- (setq all-signalled-p t )
143
+ (unwind-protect
144
+ (funcall thunk)
145
+ (pycall (format nil " sys.~A .flush" stderr-or-stdout))
146
+ (bt :signal-semaphore with-python-start-semaphore)
147
+ (without-python-gil
148
+ (bt :wait-on-semaphore with-python-end-semaphore))
149
+ (setq all-signalled-p t ))
149
150
(let* ((output (get-output-stream-string with-python-stream))
150
151
(len (length output)))
151
152
(if (zerop len)
@@ -156,7 +157,8 @@ execution of THUNK as a string."
156
157
(bt :signal-semaphore with-python-start-semaphore)
157
158
(without-python-gil
158
159
(bt :wait-on-semaphore with-python-end-semaphore)))
159
- (setf with-python-stream old-with-python-stream-value))))))
160
+ (setf with-python-stream old-with-python-stream-value)
161
+ (pycall (format nil " sys.~A .flush" stderr-or-stdout)))))))
160
162
161
163
; ;; This is more of a global variable than a dynamic variable.
162
164
You can’t perform that action at this time.
0 commit comments