Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-110771: Decompose run_forever() into parts#110773
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
a0c1fde67bfc8f3dcf97b35271dc6672f6854349c3e6226a523852d0e7f892ef94494431431261b3e3d8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -603,12 +603,12 @@ def _check_running(self): | ||
| raise RuntimeError( | ||
| 'Cannot run the event loop while another loop is running') | ||
| def_run_forever_setup(self): | ||
| """Prepare the run loop to process events. | ||
| This methodexists so that custom custom event loop subclasses (e.g., event loops | ||
| that integrate aGUI event loopwith Python's event loop) have access to all the | ||
| loopsetup logic. | ||
| """ | ||
| self._check_closed() | ||
| self._check_running() | ||
| @@ -623,12 +623,12 @@ def run_forever_setup(self): | ||
| events._set_running_loop(self) | ||
| def_run_forever_cleanup(self): | ||
| """Clean up after an event loop finishes the looping over events. | ||
| This methodexists so that custom custom event loop subclasses (e.g., event loops | ||
| that integrate aGUI event loopwith Python's event loop) have access to all the | ||
| loopcleanup logic. | ||
| """ | ||
| self._stopping = False | ||
| self._thread_id = None | ||
| @@ -642,13 +642,13 @@ def run_forever_cleanup(self): | ||
| def run_forever(self): | ||
| """Run until stop() is called.""" | ||
Member 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. Maybe clarify in this docstring that this is what calls setup/cleanup? | ||
| try: | ||
| self._run_forever_setup() | ||
| while True: | ||
| self._run_once() | ||
| if self._stopping: | ||
| break | ||
| finally: | ||
| self._run_forever_cleanup() | ||
| def run_until_complete(self, future): | ||
| """Run until the Future is done. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -314,13 +314,13 @@ def __init__(self, proactor=None): | ||
| proactor = IocpProactor() | ||
| super().__init__(proactor) | ||
| def_run_forever_setup(self): | ||
| assert self._self_reading_future is None | ||
| self.call_soon(self._loop_self_reading) | ||
| super()._run_forever_setup() | ||
gvanrossum marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| def_run_forever_cleanup(self): | ||
| super()._run_forever_cleanup() | ||
| if self._self_reading_future is not None: | ||
| ov = self._self_reading_future._ov | ||
| self._self_reading_future.cancel() | ||