From 27646ecba87fe518566db3d6b970574ad8df2490 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 31 Dec 2022 11:39:23 -0800 Subject: [PATCH] Fix tests on Python 3.11 (#106) --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 7 ++++++- src/test_typing_extensions.py | 1 + src/typing_extensions.py | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c451adcc..a2a04098 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: # Python version, because typing sometimes changed between bugfix releases. # For available versions, see: # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json - python-version: ["3.7", "3.7.1", "3.8", "3.8.0", "3.9", "3.9.0", "3.10", "3.10.0", "3.11-dev", "pypy3.9"] + python-version: ["3.7", "3.7.1", "3.8", "3.8.0", "3.9", "3.9.0", "3.10", "3.10.0", "3.11", "3.11.0", "3.12-dev", "pypy3.9"] runs-on: ubuntu-20.04 @@ -31,7 +31,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Test typing_extensions - continue-on-error: ${{ matrix.python-version == '3.11-dev' }} + continue-on-error: ${{ matrix.python-version == '3.12-dev' }} run: | # Be wary of running `pip install` here, since it becomes easy for us to # accidentally pick up typing_extensions as installed by a dependency diff --git a/CHANGELOG.md b/CHANGELOG.md index a3cd4630..79e36891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ -# Release 4.4.1 (?) +# Unreleased - Add better default value for TypeVar `default` parameter, PEP 696. Enables runtime check if `None` was passed as default. Patch by Marc Mueller (@cdce8p). +- The `@typing_extensions.override` decorator now sets the `.__override__` + attribute. Patch by Steven Troxler. +- Fix `get_type_hints()` on cross-module inherited `TypedDict` in 3.9 and 3.10. + Patch by Carl Meyer. +- Add `frozen_default` parameter on `dataclass_transform`. Patch by Erik De Bonte. # Release 4.4.0 (October 6, 2022) diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index d5982b9b..913b4901 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -3140,6 +3140,7 @@ def test_all_names_in___all__(self): def test_typing_extensions_defers_when_possible(self): exclude = { + 'dataclass_transform', 'overload', 'ParamSpec', 'Text', diff --git a/src/typing_extensions.py b/src/typing_extensions.py index 03fe268e..37efdd09 100644 --- a/src/typing_extensions.py +++ b/src/typing_extensions.py @@ -1998,7 +1998,8 @@ def int_or_str(arg: int | str) -> None: raise AssertionError("Expected code to be unreachable") -if hasattr(typing, 'dataclass_transform'): +if sys.version_info >= (3, 12): + # dataclass_transform exists in 3.11 but lacks the frozen_default parameter dataclass_transform = typing.dataclass_transform else: def dataclass_transform(