Skip to content

Conversation

@joshuarli
Copy link
Member

https://docs.python.org/3.8/library/concurrent.futures.html?highlight=concurrent%20futures#concurrent.futures.Future.set_result

In Python 3.8, set_result is gonna raise concurrent.futures.InvalidStateError if we call it more than once. I think this is desirable and we should just adjust the test cases to not do that.

@joshuarli joshuarli requested review from a team and tkaemming September 20, 2021 22:11
with self._condition:
# This method always overwrites the result, so we always overwrite
# the timing, even if another timing was already recorded.
result = super().set_result(*args, **kwargs)
Copy link
Member Author

@joshuarli joshuarli Sep 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordered things to not overwrite the timings in case set_result raises.

@joshuarli joshuarli merged commit 505f797 into master Sep 21, 2021
@joshuarli joshuarli deleted the py38/cannot-set_result-more-than-once branch September 21, 2021 20:52
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants