From 82ea677495c2fee85fd71faaccb4a7725902e5c1 Mon Sep 17 00:00:00 2001 From: Glyph Date: Sat, 27 May 2023 20:44:01 -0700 Subject: [PATCH] pywin32: add `HANDLEType` class (#10032) per http://timgolden.me.uk/pywin32-docs/PyHANDLE.html these objects actually have methods, they are not ints Co-authored-by: Alex Waygood --- stubs/pywin32/win32/lib/pywintypes.pyi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/stubs/pywin32/win32/lib/pywintypes.pyi b/stubs/pywin32/win32/lib/pywintypes.pyi index c0f995607..ac71380df 100644 --- a/stubs/pywin32/win32/lib/pywintypes.pyi +++ b/stubs/pywin32/win32/lib/pywintypes.pyi @@ -2,7 +2,8 @@ # "KeyError: 'pywintypes'" from _typeshed import Incomplete from datetime import datetime -from typing_extensions import Literal +from typing import NoReturn +from typing_extensions import Literal, Never import _win32typing @@ -15,6 +16,15 @@ class error(Exception): class com_error(Exception): ... class UnicodeType(str): ... +class HANDLEType: + def __init__(self, *args: Never, **kwargs: Never) -> NoReturn: ... + @property + def handle(self) -> int: ... + def Close(self) -> None: ... + def close(self) -> None: ... + def Detach(self) -> None: ... + def __int__(self) -> int: ... + class TimeType(datetime): Format = datetime.strftime @@ -32,7 +42,7 @@ def ACL(__bufSize: int = ...) -> _win32typing.PyACL: ... def SID(buffer, idAuthority, subAuthorities, bufSize=...) -> _win32typing.PySID: ... def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ... def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... -def HANDLE() -> int: ... +def HANDLE() -> HANDLEType: ... def HKEY() -> _win32typing.PyHKEY: ... def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ... def TimeStamp(*args, **kwargs): ... # incomplete