Skip to content

Commit

Permalink
Merge pull request #3230 from bdarnell/ci-py312
Browse files Browse the repository at this point in the history
ci: Re-enable Python 3.12 alphas
  • Loading branch information
bdarnell committed Feb 8, 2023
2 parents 0f8e10b + 129e622 commit 9ea5cdd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ env.python-version }}
Expand All @@ -47,7 +47,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ env.python-version }}
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
name: Install Python
with:
# Lint python version must be synced with tox.ini
Expand All @@ -42,12 +42,17 @@ jobs:
tox_env: py39-full
- python: '3.10'
tox_env: py310-full
- python: '3.10.8'
# Early versions of 3.10 and 3.11 had different deprecation
# warnings in asyncio. Test with them too to make sure everything
# works the same way.
tox_env: py310-full
- python: '3.11'
tox_env: py311-full
# Need more work for python 3.12. See
# https://github.com/python/cpython/issues/93453
#- python: '3.12.0-alpha - 3.12'
# tox_env: py312-full
- python: '3.11.0'
tox_env: py311-full
- python: '3.12.0-alpha - 3.12'
tox_env: py312-full
- python: 'pypy-3.8'
# Pypy is a lot slower due to jit warmup costs, so don't run the
# "full" test config there.
Expand All @@ -58,7 +63,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ matrix.python}}
Expand Down
23 changes: 1 addition & 22 deletions tornado/platform/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,6 @@ def _atexit_callback() -> None:

atexit.register(_atexit_callback)

if sys.version_info >= (3, 10):

def _get_event_loop() -> asyncio.AbstractEventLoop:
try:
return asyncio.get_running_loop()
except RuntimeError:
pass

return asyncio.get_event_loop_policy().get_event_loop()

else:
from asyncio import get_event_loop as _get_event_loop


class BaseAsyncIOLoop(IOLoop):
def initialize( # type: ignore
Expand Down Expand Up @@ -205,15 +192,7 @@ def _handle_events(self, fd: int, events: int) -> None:
handler_func(fileobj, events)

def start(self) -> None:
try:
old_loop = _get_event_loop()
except (RuntimeError, AssertionError):
old_loop = None # type: ignore
try:
asyncio.set_event_loop(self.asyncio_loop)
self.asyncio_loop.run_forever()
finally:
asyncio.set_event_loop(old_loop)
self.asyncio_loop.run_forever()

def stop(self) -> None:
self.asyncio_loop.stop()
Expand Down

0 comments on commit 9ea5cdd

Please sign in to comment.