mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Fix errors when type checking stdlib with Python 3.14 (#13977)
This commit is contained in:
+18
-15
@@ -174,6 +174,7 @@ class FunctionDef(stmt):
|
||||
returns: expr | None = ...,
|
||||
type_comment: str | None = ...,
|
||||
type_params: list[type_param] = ...,
|
||||
**kwargs: Unpack[_Attributes],
|
||||
) -> Self: ...
|
||||
|
||||
class AsyncFunctionDef(stmt):
|
||||
@@ -245,11 +246,11 @@ class AsyncFunctionDef(stmt):
|
||||
*,
|
||||
name: str = ...,
|
||||
args: arguments = ...,
|
||||
body: list[stmt],
|
||||
decorator_list: list[expr],
|
||||
returns: expr | None,
|
||||
type_comment: str | None,
|
||||
type_params: list[type_param],
|
||||
body: list[stmt] = ...,
|
||||
decorator_list: list[expr] = ...,
|
||||
returns: expr | None = ...,
|
||||
type_comment: str | None = ...,
|
||||
type_params: list[type_param] = ...,
|
||||
) -> Self: ...
|
||||
|
||||
class ClassDef(stmt):
|
||||
@@ -301,12 +302,12 @@ class ClassDef(stmt):
|
||||
def __replace__(
|
||||
self,
|
||||
*,
|
||||
name: str,
|
||||
bases: list[expr],
|
||||
keywords: list[keyword],
|
||||
body: list[stmt],
|
||||
decorator_list: list[expr],
|
||||
type_params: list[type_param],
|
||||
name: str = ...,
|
||||
bases: list[expr] = ...,
|
||||
keywords: list[keyword] = ...,
|
||||
body: list[stmt] = ...,
|
||||
decorator_list: list[expr] = ...,
|
||||
type_params: list[type_param] = ...,
|
||||
**kwargs: Unpack[_Attributes],
|
||||
) -> Self: ...
|
||||
|
||||
@@ -377,7 +378,7 @@ if sys.version_info >= (3, 12):
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(
|
||||
def __replace__( # type: ignore[override]
|
||||
self,
|
||||
*,
|
||||
name: Name = ...,
|
||||
@@ -540,7 +541,9 @@ class While(stmt):
|
||||
def __init__(self, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
def __replace__(
|
||||
self, *, test: expr = ..., body: list[stmt] = ..., orelse: list[stmt] = ..., **kwargs: Unpack[_Attributes]
|
||||
) -> Self: ...
|
||||
|
||||
class If(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -725,7 +728,7 @@ class Assert(stmt):
|
||||
def __init__(self, test: expr, msg: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, test: expr, msg: expr | None, **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
def __replace__(self, *, test: expr = ..., msg: expr | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
||||
class Import(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -775,7 +778,7 @@ class Global(stmt):
|
||||
def __init__(self, names: list[str], **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, names: list[str], **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
def __replace__(self, *, names: list[str] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
||||
class Nonlocal(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
|
||||
@@ -21,7 +21,9 @@ from .futures import Future
|
||||
from .protocols import BaseProtocol
|
||||
from .tasks import Task
|
||||
from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport
|
||||
from .unix_events import AbstractChildWatcher
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
from .unix_events import AbstractChildWatcher
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 14):
|
||||
|
||||
@@ -60,12 +60,14 @@ from sqlite3.dbapi2 import (
|
||||
sqlite_version as sqlite_version,
|
||||
sqlite_version_info as sqlite_version_info,
|
||||
threadsafety as threadsafety,
|
||||
version_info as version_info,
|
||||
)
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, Protocol, SupportsIndex, TypeVar, final, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
from sqlite3.dbapi2 import version_info as version_info
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
from sqlite3.dbapi2 import (
|
||||
LEGACY_TRANSACTION_CONTROL as LEGACY_TRANSACTION_CONTROL,
|
||||
|
||||
+3
-1
@@ -37,7 +37,6 @@ __all__ = [
|
||||
"AsyncIterator",
|
||||
"Awaitable",
|
||||
"BinaryIO",
|
||||
"ByteString",
|
||||
"Callable",
|
||||
"ChainMap",
|
||||
"ClassVar",
|
||||
@@ -106,6 +105,9 @@ __all__ = [
|
||||
"runtime_checkable",
|
||||
]
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
__all__ += ["ByteString"]
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
__all__ += ["Concatenate", "ParamSpec", "ParamSpecArgs", "ParamSpecKwargs", "TypeAlias", "TypeGuard", "is_typeddict"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user