Fix some CAPI annotations (#13081)

This commit is contained in:
Stephen Morton
2024-11-23 16:00:49 -08:00
committed by GitHub
parent 7ab6620c0f
commit 9614cc2d88
5 changed files with 8 additions and 7 deletions

View File

@@ -58,7 +58,6 @@ multiprocessing.synchronize.SemLock.release
numbers.Number.__hash__ # typeshed marks this as abstract but code just sets this as None
optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr
pickle.Pickler.reducer_override # implemented in C pickler
pyexpat.expat_CAPI
select.poll # Depends on configuration
selectors.DevpollSelector # Depends on configuration
shutil.rmtree # stubtest doesn't like that we have this as an instance of a callback protocol instead of a function
@@ -77,7 +76,6 @@ typing.type_check_only # typing decorator that is not available at runtime
unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it
weakref.WeakKeyDictionary.update
weakref.WeakValueDictionary.update
xml.parsers.expat.expat_CAPI
# ==========
# TODO: Modules that exist at runtime, but are missing from stubs

View File

@@ -110,7 +110,6 @@ tkinter.Tk.__init__
# Exists at runtime, but missing from stubs
_?contextvars.ContextVar.__class_getitem__
datetime.datetime_CAPI
dummy_threading.ExceptHookArgs
dummy_threading.Lock
dummy_threading.RLock

View File

@@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer, WriteableBuffer
from collections.abc import Iterable
from socket import error as error, gaierror as gaierror, herror as herror, timeout as timeout
from typing import Any, SupportsIndex, overload
from typing_extensions import TypeAlias
from typing_extensions import CapsuleType, TypeAlias
_CMSG: TypeAlias = tuple[int, int, bytes]
_CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
@@ -842,4 +842,4 @@ def if_nameindex() -> list[tuple[int, str]]: ...
def if_nametoindex(oname: str, /) -> int: ...
def if_indextoname(index: int, /) -> str: ...
CAPI: object
CAPI: CapsuleType

View File

@@ -2,7 +2,7 @@ import sys
from abc import abstractmethod
from time import struct_time
from typing import ClassVar, Final, NoReturn, SupportsIndex, final, overload, type_check_only
from typing_extensions import Self, TypeAlias, deprecated
from typing_extensions import CapsuleType, Self, TypeAlias, deprecated
if sys.version_info >= (3, 11):
__all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo", "MINYEAR", "MAXYEAR", "UTC")
@@ -332,3 +332,5 @@ class datetime(date):
def __sub__(self, value: Self, /) -> timedelta: ...
@overload
def __sub__(self, value: timedelta, /) -> Self: ...
datetime_CAPI: CapsuleType

View File

@@ -2,7 +2,7 @@ from _typeshed import ReadableBuffer, SupportsRead
from collections.abc import Callable
from pyexpat import errors as errors, model as model
from typing import Any, Final, final
from typing_extensions import TypeAlias
from typing_extensions import CapsuleType, TypeAlias
from xml.parsers.expat import ExpatError as ExpatError
EXPAT_VERSION: Final[str] # undocumented
@@ -78,3 +78,5 @@ def ErrorString(code: int, /) -> str: ...
def ParserCreate(
encoding: str | None = None, namespace_separator: str | None = None, intern: dict[str, Any] | None = None
) -> XMLParserType: ...
expat_CAPI: CapsuleType