Fix Tornado event_loop warning on Python 3.10 and later#2777
Fix Tornado event_loop warning on Python 3.10 and later#2777pquentin merged 4 commits intourllib3:mainfrom
Conversation
33872d0 to
14a2784
Compare
3a8f21a to
e374bb4
Compare
acd790f to
1bae78c
Compare
1bae78c to
7e4ecbb
Compare
| ) | ||
| cls.server_thread = run_loop_in_thread(cls.io_loop) | ||
| with contextlib.ExitStack() as stack: | ||
| io_loop = stack.enter_context(run_loop_in_thread()) |
There was a problem hiding this comment.
ExitStack is used so we can use with for the run_loop_in_thread() context manager and close it if anything fails during setup then cls._stack = stack.pop_all() is used to close the context manager later
There was a problem hiding this comment.
So if we had a pytest fixture here instead of setup_class/teardown_class, could we use run_loop_in_thread as a normal context manager? If yes, can we please do that?
There was a problem hiding this comment.
yes, can I leave that for another PR?
There was a problem hiding this comment.
Thanks. OK for removing ExitStack in another pull request and for leaving from __future__ import annotations. Can you please:
- Add
error:There is no current event loop:DeprecationWarning:tornado.ioloopin setup.cfg asfilterwarnings - Upgrade to Tornado 6.2
- Restore the scheme parameter (this will get rid of the confusing ternary expressions)
7b73405 to
2865721
Compare
done! |
2865721 to
3822585
Compare
pquentin
left a comment
There was a problem hiding this comment.
Thanks you! Looks good to me.
Fixes #2772