Skip to content

Commit 5d90de7

Browse files
committed
do not force shutdown the executor in the cleanup
See #156 This prevent the 'OSError: handle is closed' after the runner is closed in Python 3.7
1 parent 1f38d28 commit 5d90de7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adaptive/runner.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import functools
88
import inspect
99
import os
10+
import sys
1011
import time
1112
import traceback
1213
import warnings
@@ -241,7 +242,12 @@ def _remove_unfinished(self):
241242

242243
def _cleanup(self):
243244
if self.shutdown_executor:
244-
self.executor.shutdown(wait=False)
245+
# XXX: temporary set wait=True for Python 3.7
246+
# see https://github.com/python-adaptive/adaptive/issues/156
247+
# and https://github.com/python-adaptive/adaptive/pull/164
248+
self.executor.shutdown(
249+
wait=True if sys.version_info >= (3, 7) else False
250+
)
245251
self.end_time = time.time()
246252

247253
@property

0 commit comments

Comments
 (0)