Skip to content

Commit a6f559f

Browse files
committed
backwards compat
1 parent f742b20 commit a6f559f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

conditional_futures/threadpool.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def is_no_gil() -> bool:
1313

1414

1515
IS_NO_GIL = is_no_gil()
16+
IS_PY_GTE314 = sys.version_info >= (3, 14)
1617

1718

1819
class SingleThreadExecutor(Executor):
@@ -94,13 +95,14 @@ def map(
9495
chunksize: int = 1,
9596
buffersize: int | None = None,
9697
) -> Iterator[TVReturn]:
97-
return self._executor.map(
98-
fn,
99-
*iterables,
100-
timeout=timeout,
101-
chunksize=chunksize,
102-
buffersize=buffersize,
103-
)
98+
# buffersize is only supported in Python 3.14+
99+
kwargs: dict[str, Any] = {
100+
'timeout': timeout,
101+
'chunksize': chunksize,
102+
}
103+
if IS_PY_GTE314 and buffersize is not None:
104+
kwargs['buffersize'] = buffersize
105+
return self._executor.map(fn, *iterables, **kwargs)
104106

105107
def shutdown(
106108
self,

0 commit comments

Comments
 (0)