Skip to content

Commit

Permalink
Merge pull request #3196 from bdarnell/pyversion-update
Browse files Browse the repository at this point in the history
setup: Add Python 3.11 final and 3.12 alpha to CI
  • Loading branch information
bdarnell committed Nov 19, 2022
2 parents 031c435 + 2ef1fd3 commit 8fcbf49
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ jobs:
tox_env: py39-full
- python: '3.10'
tox_env: py310-full
- python: '3.11.0-alpha - 3.11'
- python: '3.11'
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 Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build = "cp3[789]* cp310*"
build = "cp3[789]* cp310* cp311*"
test-command = "python -m tornado.test"

[tool.cibuildwheel.macos]
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def get_tag(self):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
24 changes: 14 additions & 10 deletions tornado/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,21 +763,25 @@ def run(self) -> None:
return
self.future = None
try:
exc_info = None

try:
value = future.result()
except Exception:
exc_info = sys.exc_info()
future = None
except Exception as e:
# Save the exception for later. It's important that
# gen.throw() not be called inside this try/except block
# because that makes sys.exc_info behave unexpectedly.
exc: Optional[Exception] = e
else:
exc = None
finally:
future = None

if exc_info is not None:
if exc is not None:
try:
yielded = self.gen.throw(*exc_info) # type: ignore
yielded = self.gen.throw(exc)
finally:
# Break up a reference to itself
# for faster GC on CPython.
exc_info = None
# Break up a circular reference for faster GC on
# CPython.
del exc
else:
yielded = self.gen.send(value)

Expand Down
2 changes: 1 addition & 1 deletion tornado/test/gen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ def test_propagate_to_first_yield_with_native_async_function(self):
x = 10

async def native_async_function():
self.assertEquals(ctx_var.get(), x)
self.assertEqual(ctx_var.get(), x)

ctx_var.set(x)
yield native_async_function()
Expand Down
2 changes: 1 addition & 1 deletion tornado/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def post_coroutine(self, *args, **kwargs):
if self._test_generator is not None and getattr(
self._test_generator, "cr_running", True
):
self._test_generator.throw(type(e), e)
self._test_generator.throw(e)
# In case the test contains an overly broad except
# clause, we may get back here.
# Coroutine was stopped or didn't raise a useful stack trace,
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[tox]
envlist =
# Basic configurations: Run the tests for each python version.
py37-full,py38-full,py39-full,py310-full,pypy3-full
py37-full,py38-full,py39-full,py310-full,py311-full,pypy3-full

# Build and test the docs with sphinx.
docs
Expand All @@ -32,6 +32,7 @@ basepython =
py39: python3.9
py310: python3.10
py311: python3.11
py312: python3.12
pypy3: pypy3
# In theory, it doesn't matter which python version is used here.
# In practice, things like changes to the ast module can alter
Expand All @@ -50,7 +51,7 @@ deps =

setenv =
# Treat the extension as mandatory in testing (but not on pypy)
{py3,py37,py38,py39,py310}: TORNADO_EXTENSION=1
{py3,py37,py38,py39,py310,py311}: TORNADO_EXTENSION=1
# CI workers are often overloaded and can cause our tests to exceed
# the default timeout of 5s.
ASYNC_TEST_TIMEOUT=25
Expand All @@ -62,7 +63,7 @@ setenv =
# during sdist installation (and it doesn't seem to be
# possible to set environment variables during that phase of
# tox).
{py3,py37,py38,py39,py310,pypy3}: PYTHONWARNINGS=error:::tornado
{py3,py37,py38,py39,py310,py311,pypy3}: PYTHONWARNINGS=error:::tornado


# All non-comment lines but the last must end in a backslash.
Expand Down

0 comments on commit 8fcbf49

Please sign in to comment.