From f2ee9e9368a18b19bbf2ac05b6eb6bfea96d9a0c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 12 Jul 2023 21:21:05 +0100 Subject: [PATCH] Stubtest: fixes for py312beta4 (#10449) * Revert "json: add AttrDict in py312 (#10212)" This reverts commit 7994f165daadcb8f869fd3ee304bece97ad1cee9. * TaskGroup updates --- stdlib/asyncio/taskgroups.pyi | 8 +++++--- stdlib/json/__init__.pyi | 9 --------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 08ea8f665..47d9bb2f6 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -1,5 +1,4 @@ -# This only exists in 3.11+. See VERSIONS. - +import sys from contextvars import Context from types import TracebackType from typing import TypeVar @@ -8,7 +7,10 @@ from typing_extensions import Self from . import _CoroutineLike from .tasks import Task -__all__ = ["TaskGroup"] +if sys.version_info >= (3, 12): + __all__ = ("TaskGroup",) +else: + __all__ = ["TaskGroup"] _T = TypeVar("_T") diff --git a/stdlib/json/__init__.pyi b/stdlib/json/__init__.pyi index dc0cdff92..63e9718ee 100644 --- a/stdlib/json/__init__.pyi +++ b/stdlib/json/__init__.pyi @@ -1,4 +1,3 @@ -import sys from _typeshed import SupportsRead, SupportsWrite from collections.abc import Callable from typing import Any @@ -7,8 +6,6 @@ from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDeco from .encoder import JSONEncoder as JSONEncoder __all__ = ["dump", "dumps", "load", "loads", "JSONDecoder", "JSONDecodeError", "JSONEncoder"] -if sys.version_info >= (3, 12): - __all__ += ["AttrDict"] def dumps( obj: Any, @@ -62,9 +59,3 @@ def load( **kwds: Any, ) -> Any: ... def detect_encoding(b: bytes | bytearray) -> str: ... # undocumented - -if sys.version_info >= (3, 12): - class AttrDict(dict[str, Any]): - def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ...