-
Notifications
You must be signed in to change notification settings - Fork 183
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
Fix/futures context #1512
Fix/futures context #1512
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
0df9525
to
b72086b
Compare
b72086b
to
5c77ab5
Compare
|
||
def __raise_deprecation_warning(self) -> None: | ||
warnings.warn( | ||
"`FuturesExecutorMixin.futures_executor` is deprecated and will be removed in a future release. Use `FuturesExecutorMixin.create_futures_executor` instead.", |
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.
maybe specify "use FuturesExecutorMixin.create_futures_executor()
as a context manager instead."? better to be explicit
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.
Technically you could use it not as a context manager:
executor = self.create_futures_executor()
executor.shutdown()
def __del__(self) -> None: | ||
executor = self.futures_executor | ||
|
||
if executor is not None: | ||
self.futures_executor = None # pyright: ignore[reportAttributeAccessIssue] In practice this is safe, nobody will access this attribute after this point | ||
|
||
with contextlib.suppress(Exception): | ||
# don't raise exceptions in __del__ | ||
executor.shutdown(wait=True) |
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.
is this currently safe to remove without causing the issues that caused it to be added?
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.
I believe that was resolved by #1074. This particular method was only introduced as a clean-up effort.
Describe your changes
Fixed
FuturesExecutorMixin
cleanup.Deprecated
FuturesExecutorMixin.futures_executor
. UseFuturesExecutorMixin.create_futures_executor
instead.Issue ticket number and link
Closes #1507