Repository navigation
Upgrade Python version to 3.15 in CI pipeline #1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
464b2af
f887292
00be59d
d04d0d2
5d8a6fd
bce021c
ad9efae
7e01e75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,22 @@ | ||
| import contextlib | ||
| import queue | ||
| import sys | ||
| from collections.abc import Iterable, Iterator | ||
| from concurrent.futures import ( | ||
| Executor as FutureExecutor, | ||
| ) | ||
| from concurrent.futures import ( | ||
| Future, | ||
| ) | ||
| from threading import Thread | ||
| from typing import Callable, Optional, Union | ||
| from typing import Any, Callable, Optional, TypeVar, Union | ||
|
|
||
| from executorlib.standalone.inputcheck import check_resource_dict | ||
| from executorlib.standalone.queue import cancel_items_in_queue | ||
| from executorlib.standalone.serialize import cloudpickle_register | ||
|
|
||
| _T = TypeVar("_T") | ||
|
|
||
|
|
||
| def validate_resource_dict(resource_dict: dict): | ||
| """ | ||
|
|
@@ -179,11 +183,12 @@ def submit( # type: ignore | |
|
|
||
| def map( | ||
| self, | ||
| fn: Callable, | ||
| *iterables, | ||
| fn: Callable[..., _T], | ||
| *iterables: Iterable[Any], | ||
| timeout: Optional[float] = None, | ||
| chunksize: int = 1, | ||
| ): | ||
| buffersize: Optional[int] = None, | ||
| ) -> Iterator[_T]: | ||
| """Returns an iterator equivalent to map(fn, iter). | ||
|
|
||
| Args: | ||
|
|
@@ -212,6 +217,14 @@ def map( | |
| i.result() if isinstance(i, Future) else i for i in iterables | ||
| ) | ||
|
|
||
| if sys.version_info >= (3, 14): | ||
| return super().map( | ||
| fn, | ||
| *iterables, | ||
| timeout=timeout, | ||
| chunksize=chunksize, | ||
| buffersize=buffersize, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
| return super().map(fn, *iterables, timeout=timeout, chunksize=chunksize) | ||
|
|
||
| def shutdown(self, wait: bool = True, *, cancel_futures: bool = False): | ||
|
|
@@ -263,6 +276,10 @@ def __len__(self) -> int: | |
| queue_size = self._future_queue.qsize() | ||
| return queue_size | ||
|
|
||
| def __bool__(self) -> bool: | ||
| """Return True regardless of the number of queued futures.""" | ||
| return True | ||
|
|
||
| def __del__(self): | ||
| """ | ||
| Clean-up the resources associated with the Executor. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reject or implement
buffersizeon Python versions before 3.14.If a caller sets
buffersizeon Python 3.13, this branch falls through tosuper().map()without that value. Python 3.13 then collects the iterables eagerly. A caller that expects bounded submission can queue every task or remain blocked on an unbounded iterable. Implement buffering on those versions, or reject a non-Nonevalue before the fallback call. (docs.python.org)