Repository: python/typeshed
Pull request #13885: Bump gevent to 25.4.* 
Author: login: LordGvozd
Created: 2025-04-25T19:11:45Z | Merged: 2025-05-11T18:05:26Z

Closes #13850


Diff:
diff --git a/stubs/gevent/@tests/stubtest_allowlist_darwin.txt b/stubs/gevent/@tests/stubtest_allowlist_darwin.txt
index 99849c10b71b..dd72ec9eff22 100644
--- a/stubs/gevent/@tests/stubtest_allowlist_darwin.txt
+++ b/stubs/gevent/@tests/stubtest_allowlist_darwin.txt
@@ -17,10 +17,6 @@ gevent.libev.watcher.watcher.feed
 # undocumented argument for internal use only
 gevent.libev.watcher.watcher.__init__
 
-# ares_host_result always has the same layout, so we set the arguments on __new__
-# to reflect that fact, we don't care that the implementation accepts any number
-# of arguments
-gevent.resolver.cares.ares_host_result.__new__
 
 # we have punted on socket, the gevent version of these functions sometimes use
 # named parameters, while the base implementation only allows positional arguments
diff --git a/stubs/gevent/@tests/stubtest_allowlist_linux.txt b/stubs/gevent/@tests/stubtest_allowlist_linux.txt
index d768857225d1..83da879a8f8f 100644
--- a/stubs/gevent/@tests/stubtest_allowlist_linux.txt
+++ b/stubs/gevent/@tests/stubtest_allowlist_linux.txt
@@ -24,10 +24,6 @@ gevent.libev.watcher.watcher.feed
 # undocumented argument for internal use only
 gevent.libev.watcher.watcher.__init__
 
-# ares_host_result always has the same layout, so we set the arguments on __new__
-# to reflect that fact, we don't care that the implementation accepts any number
-# of arguments
-gevent.resolver.cares.ares_host_result.__new__
 
 # we have punted on socket, the gevent version of these functions sometimes use
 # named parameters, while the base implementation only allows positional arguments
diff --git a/stubs/gevent/@tests/stubtest_allowlist_win32.txt b/stubs/gevent/@tests/stubtest_allowlist_win32.txt
index 52eddde03a7c..a8a54020a4c7 100644
--- a/stubs/gevent/@tests/stubtest_allowlist_win32.txt
+++ b/stubs/gevent/@tests/stubtest_allowlist_win32.txt
@@ -19,9 +19,3 @@ gevent.libev.corecext.*
 # these won't work until we find out if we can install libev somehow with choco
 gevent.libev.corecffi
 gevent.libev.watcher
-
-# these don't work on windows
-gevent.ares
-gevent.resolver.ares
-gevent.resolver.cares
-gevent.resolver_ares
diff --git a/stubs/gevent/METADATA.toml b/stubs/gevent/METADATA.toml
index 960f4c760e7f..456b719c6819 100644
--- a/stubs/gevent/METADATA.toml
+++ b/stubs/gevent/METADATA.toml
@@ -1,4 +1,4 @@
-version = "24.11.*"
+version = "25.4.*"
 upstream_repository = "https://github.com/gevent/gevent"
 requires = ["types-greenlet", "types-psutil"]
 
diff --git a/stubs/gevent/gevent/_config.pyi b/stubs/gevent/gevent/_config.pyi
index 802f374fea38..a7824ba9714e 100644
--- a/stubs/gevent/gevent/_config.pyi
+++ b/stubs/gevent/gevent/_config.pyi
@@ -72,6 +72,7 @@ class Config:
     ares_udp_port: _SettingDescriptor[str | int | None]
     ares_tcp_port: _SettingDescriptor[str | int | None]
     ares_servers: _SettingDescriptor[Sequence[str] | str | None]
+    print_blocking_reports: _SettingDescriptor[bool]
 
 class ImportableSetting(Generic[_T]):
     default: str | Sequence[str]
@@ -141,6 +142,10 @@ class MaxBlockingTime(FloatSettingMixin, Setting[float]):
     default: float
     desc: str
 
+class PrintBlockingReports(BoolSettingMixin, Setting[bool]):
+    default: bool
+    desc: str
+
 class MonitorMemoryPeriod(FloatSettingMixin, Setting[float]):
     default: int
     desc: str
diff --git a/stubs/gevent/gevent/ares.pyi b/stubs/gevent/gevent/ares.pyi
index 8fa5509e5fa6..6104efb65acc 100644
--- a/stubs/gevent/gevent/ares.pyi
+++ b/stubs/gevent/gevent/ares.pyi
@@ -1,6 +1,3 @@
-import sys
-
 from gevent.resolver.cares import *
 
-if sys.platform != "win32":
-    __all__ = ["channel"]
+__all__ = ["channel"]
diff --git a/stubs/gevent/gevent/lock.pyi b/stubs/gevent/gevent/lock.pyi
index ddaf1ab85701..2daa782741fa 100644
--- a/stubs/gevent/gevent/lock.pyi
+++ b/stubs/gevent/gevent/lock.pyi
@@ -38,3 +38,4 @@ class RLock:
     def __enter__(self) -> bool: ...
     def release(self) -> None: ...
     def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ...
+    def locked(self) -> bool: ...
diff --git a/stubs/gevent/gevent/pywsgi.pyi b/stubs/gevent/gevent/pywsgi.pyi
index 8c25035fd2cb..91400018eabd 100644
--- a/stubs/gevent/gevent/pywsgi.pyi
+++ b/stubs/gevent/gevent/pywsgi.pyi
@@ -28,6 +28,7 @@ class Input:
     position: int
     chunked_input: bool
     chunk_length: int
+    send_100_continue_enabled: bool
     def __init__(
         self, rfile: BufferedReader, content_length: int | None, socket: _GeventSocket | None = None, chunked_input: bool = False
     ) -> None: ...
diff --git a/stubs/gevent/gevent/queue.pyi b/stubs/gevent/gevent/queue.pyi
index 515aae6f5588..b95cb5212be6 100644
--- a/stubs/gevent/gevent/queue.pyi
+++ b/stubs/gevent/gevent/queue.pyi
@@ -1,9 +1,10 @@
 import sys
+import types
 from collections import deque
 from collections.abc import Iterable
 
 # technically it is using _PySimpleQueue, which has the same interface as SimpleQueue
-from queue import Empty as Empty, Full as Full, SimpleQueue as SimpleQueue
+from queue import Empty as Empty, Full as Full
 from typing import Any, Generic, Literal, TypeVar, final, overload
 from typing_extensions import Self
 
@@ -19,13 +20,16 @@ else:
 
 _T = TypeVar("_T")
 
-class Queue(Generic[_T]):
+class SimpleQueue(Generic[_T]):
     @property
     def hub(self) -> Hub: ...  # readonly in Cython
     @property
     def queue(self) -> deque[_T]: ...  # readonly in Cython
     maxsize: int | None
     is_shutdown: bool
+
+    @classmethod
+    def __class_getitem__(cls, item: Any, /) -> types.GenericAlias: ...
     @overload
     def __init__(self, maxsize: int | None = None) -> None: ...
     @overload
@@ -42,13 +46,27 @@ class Queue(Generic[_T]):
     def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
     def put_nowait(self, item: _T) -> None: ...
     def qsize(self) -> int: ...
-    def shutdown(self, immediate: bool = False) -> None: ...
     def __bool__(self) -> bool: ...
     def __iter__(self) -> Self: ...
     def __len__(self) -> int: ...
     def __next__(self) -> _T: ...
     next = __next__
 
+class Queue(SimpleQueue[_T]):
+    @property
+    def unfinished_tasks(self) -> int: ...  # readonly in Cython
+    @overload
+    def __init__(self, maxsize: int | None = None, *, unfinished_tasks: int | None = None) -> None: ...
+    @overload
+    def __init__(self, maxsize: int | None, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ...
+    @overload
+    def __init__(self, maxsize: int | None = None, *, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ...
+    def join(self, timeout: float | None = None) -> bool: ...
+    def task_done(self) -> None: ...
+    def shutdown(self, immediate: bool = False) -> None: ...
+
+JoinableQueue = Queue
+
 @final
 class UnboundQueue(Queue[_T]):
     @overload
@@ -61,18 +79,6 @@ class UnboundQueue(Queue[_T]):
 class PriorityQueue(Queue[_T]): ...
 class LifoQueue(Queue[_T]): ...
 
-class JoinableQueue(Queue[_T]):
-    @property
-    def unfinished_tasks(self) -> int: ...  # readonly in Cython
-    @overload
-    def __init__(self, maxsize: int | None = None, *, unfinished_tasks: int | None = None) -> None: ...
-    @overload
-    def __init__(self, maxsize: int | None, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ...
-    @overload
-    def __init__(self, maxsize: int | None = None, *, items: Iterable[_T], unfinished_tasks: int | None = None) -> None: ...
-    def join(self, timeout: float | None = None) -> bool: ...
-    def task_done(self) -> None: ...
-
 class Channel(Generic[_T]):
     @property
     def getters(self) -> deque[Waiter[Any]]: ...  # readonly in Cython
@@ -81,6 +87,8 @@ class Channel(Generic[_T]):
     @property
     def hub(self) -> Hub: ...  # readonly in Cython
     def __init__(self, maxsize: Literal[1] = 1) -> None: ...
+    @classmethod
+    def __class_getitem__(cls, item: Any, /) -> types.GenericAlias: ...
     @property
     def balance(self) -> int: ...
     def qsize(self) -> Literal[0]: ...
diff --git a/stubs/gevent/gevent/resolver/ares.pyi b/stubs/gevent/gevent/resolver/ares.pyi
index a20e6b99a1e3..29c5ea0cb843 100644
--- a/stubs/gevent/gevent/resolver/ares.pyi
+++ b/stubs/gevent/gevent/resolver/ares.pyi
@@ -1,43 +1,40 @@
-import sys
+from collections.abc import Sequence
+from typing import TypedDict
 
-if sys.platform != "win32":
-    from collections.abc import Sequence
-    from typing import TypedDict
+from gevent._types import _Watcher
+from gevent.hub import Hub
+from gevent.resolver import AbstractResolver
+from gevent.resolver.cares import channel
 
-    from gevent._types import _Watcher
-    from gevent.hub import Hub
-    from gevent.resolver import AbstractResolver
-    from gevent.resolver.cares import channel
+class _ChannelArgs(TypedDict):
+    flags: str | int | None
+    timeout: str | float | None
+    tries: str | int | None
+    ndots: str | int | None
+    udp_port: str | int | None
+    tcp_port: str | int | None
+    servers: Sequence[str] | str | None
 
-    class _ChannelArgs(TypedDict):
-        flags: str | int | None
-        timeout: str | float | None
-        tries: str | int | None
-        ndots: str | int | None
-        udp_port: str | int | None
-        tcp_port: str | int | None
-        servers: Sequence[str] | str | None
+class Resolver(AbstractResolver):
+    cares_class: type[channel]
+    hub: Hub
+    cares: channel
+    pid: int
+    params: _ChannelArgs
+    fork_watcher: _Watcher
+    def __init__(
+        self,
+        hub: Hub | None = None,
+        use_environ: bool = True,
+        *,
+        flags: str | int | None = None,
+        timeout: str | float | None = None,
+        tries: str | int | None = None,
+        ndots: str | int | None = None,
+        udp_port: str | int | None = None,
+        tcp_port: str | int | None = None,
+        servers: Sequence[str] | str | None = None,
+    ) -> None: ...
+    def __del__(self) -> None: ...
 
-    class Resolver(AbstractResolver):
-        cares_class: type[channel]
-        hub: Hub
-        cares: channel
-        pid: int
-        params: _ChannelArgs
-        fork_watcher: _Watcher
-        def __init__(
-            self,
-            hub: Hub | None = None,
-            use_environ: bool = True,
-            *,
-            flags: str | int | None = None,
-            timeout: str | float | None = None,
-            tries: str | int | None = None,
-            ndots: str | int | None = None,
-            udp_port: str | int | None = None,
-            tcp_port: str | int | None = None,
-            servers: Sequence[str] | str | None = None,
-        ) -> None: ...
-        def __del__(self) -> None: ...
-
-    __all__ = ["Resolver"]
+__all__ = ["Resolver"]
diff --git a/stubs/gevent/gevent/resolver/cares.pyi b/stubs/gevent/gevent/resolver/cares.pyi
index b8f3546bf97e..21f3e504c7e8 100644
--- a/stubs/gevent/gevent/resolver/cares.pyi
+++ b/stubs/gevent/gevent/resolver/cares.pyi
@@ -1,53 +1,50 @@
-import sys
+from collections.abc import Callable, Iterable, Sequence
+from typing import Any, Generic, TypeVar
+from typing_extensions import Self
 
-if sys.platform != "win32":
-    from collections.abc import Callable, Sequence
-    from typing import Any, Generic, TypeVar
-    from typing_extensions import Self
+from gevent._types import _AddrinfoResult, _Loop, _NameinfoResult, _SockAddr
 
-    from gevent._types import _AddrinfoResult, _Loop, _NameinfoResult, _SockAddr
+_T = TypeVar("_T")
 
-    _T = TypeVar("_T")
+class ares_host_result(tuple[str, list[str], list[str]]):
+    family: int
+    def __new__(cls, family: int, iterable: Iterable[Any]) -> Self: ...
 
-    class Result(Generic[_T]):
-        exception: BaseException | None
-        value: _T | None
-        def __init__(self, value: _T | None = None, exception: BaseException | None = None) -> None: ...
-        def get(self) -> Any | None: ...
-        def successful(self) -> bool: ...
+class Result(Generic[_T]):
+    exception: BaseException | None
+    value: _T | None
+    def __init__(self, value: _T | None = None, exception: BaseException | None = None) -> None: ...
+    def get(self) -> Any | None: ...
+    def successful(self) -> bool: ...
 
-    class ares_host_result(tuple[str, list[str], list[str]]):
-        family: int
-        def __new__(cls, family: int, hostname: str, aliases: list[str], addr_list: list[str], /) -> Self: ...
+class channel:
+    @property
+    def loop(self) -> _Loop: ...
+    def __init__(
+        self,
+        loop: _Loop,
+        flags: str | int | None = None,
+        timeout: str | float | None = None,
+        tries: str | int | None = None,
+        ndots: str | int | None = None,
+        udp_port: str | int | None = None,
+        tcp_port: str | int | None = None,
+        servers: Sequence[str] | str | None = None,
+    ) -> None: ...
+    def destroy(self) -> None: ...
+    def getaddrinfo(
+        self,
+        callback: Callable[[Result[_AddrinfoResult]], object],
+        name: str,
+        service: str | None,
+        family: int = 0,
+        type: int = 0,
+        proto: int = 0,
+        flags: int = 0,
+    ) -> None: ...
+    def gethostbyaddr(self, callback: Callable[[Result[ares_host_result]], object], addr: str) -> Any: ...
+    def gethostbyname(self, callback: Callable[[Result[ares_host_result]], object], name: str, family: int = ...) -> None: ...
+    def getnameinfo(self, callback: Callable[[Result[_NameinfoResult]], object], sockaddr: _SockAddr, flags: int) -> None: ...
+    def set_servers(self, servers: Sequence[str] | str | None = None) -> None: ...
 
-    class channel:
-        @property
-        def loop(self) -> _Loop: ...
-        def __init__(
-            self,
-            loop: _Loop,
-            flags: str | int | None = None,
-            timeout: str | float | None = None,
-            tries: str | int | None = None,
-            ndots: str | int | None = None,
-            udp_port: str | int | None = None,
-            tcp_port: str | int | None = None,
-            servers: Sequence[str] | str | None = None,
-        ) -> None: ...
-        def destroy(self) -> None: ...
-        def getaddrinfo(
-            self,
-            callback: Callable[[Result[_AddrinfoResult]], object],
-            name: str,
-            service: str | None,
-            family: int = 0,
-            type: int = 0,
-            proto: int = 0,
-            flags: int = 0,
-        ) -> None: ...
-        def gethostbyaddr(self, callback: Callable[[Result[ares_host_result]], object], addr: str) -> Any: ...
-        def gethostbyname(self, callback: Callable[[Result[ares_host_result]], object], name: str, family: int = ...) -> None: ...
-        def getnameinfo(self, callback: Callable[[Result[_NameinfoResult]], object], sockaddr: _SockAddr, flags: int) -> None: ...
-        def set_servers(self, servers: Sequence[str] | str | None = None) -> None: ...
-
-    __all__ = ["channel"]
+__all__ = ["channel"]
diff --git a/stubs/gevent/gevent/resolver_ares.pyi b/stubs/gevent/gevent/resolver_ares.pyi
index 5eb75234139c..4d1fbbaae20e 100644
--- a/stubs/gevent/gevent/resolver_ares.pyi
+++ b/stubs/gevent/gevent/resolver_ares.pyi
@@ -1,6 +1,3 @@
-import sys
-
 from gevent.resolver.ares import *
 
-if sys.platform != "win32":
-    __all__ = ["Resolver"]
+__all__ = ["Resolver"]


Reviews:
user: login: sobolevn
body: Thanks! Now the PR is to the correct branch. Please, add `__class_getitem__` methods that were added to the original package and we are good to go 👍 
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-25T22:30:04Z
user: login: srittau
body: Thanks.

There is a new class `gevent._config.PrintBlockingReports` that needs to be added.

Also a few other remarks below.
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-05-11T12:39:36Z
user: login: srittau
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-11T17:59:46Z

Review comments:
diff_hunk: @@ -42,26 +46,25 @@ class Queue(Generic[_T]):
     def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
     def put_nowait(self, item: _T) -> None: ...
     def qsize(self) -> int: ...
-    def shutdown(self, immediate: bool = False) -> None: ...
     def __bool__(self) -> bool: ...
     def __iter__(self) -> Self: ...
     def __len__(self) -> int: ...
     def __next__(self) -> _T: ...
     next = __next__
 
 @final
-class UnboundQueue(Queue[_T]):
+class UnboundQueue(SimpleQueue[_T]):
     @overload
     def __init__(self, maxsize: None = None) -> None: ...
     @overload
     def __init__(self, maxsize: None, items: Iterable[_T]) -> None: ...
     @overload
     def __init__(self, maxsize: None = None, *, items: Iterable[_T]) -> None: ...
 
-class PriorityQueue(Queue[_T]): ...
-class LifoQueue(Queue[_T]): ...
+class PriorityQueue(SimpleQueue[_T]): ...
+class LifoQueue(SimpleQueue[_T]): ...
path: stubs/gevent/gevent/queue.pyi
user: login: srittau
body: At least in 25.4.2, these derive from `Queue`: 

https://github.com/gevent/gevent/blob/df6c474a91ed70de677723747ae82a75e1c4ed3e/src/gevent/queue.py#L590
created_at: 2025-05-11T12:37:43Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,3 @@
+from gevent.resolver import cares
+
+print(cares.ares_host_result(1, [1, 2, "asd"]))
path: еуыегы/main.py
user: login: srittau
body: This file seems to have been added by mistake.
created_at: 2025-05-11T12:39:24Z
author_association: COLLABORATOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-04-25T19:23:04Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: LordGvozd
created_at: 2025-04-25T19:23:47Z
body: Looks like gevent has updated since last PR, I'll work on that 
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-27T20:02:12Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-28T19:01:49Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: srittau
created_at: 2025-05-05T14:43:19Z
body: stubtest has some complaints (Windows only): https://github.com/python/typeshed/actions/runs/14715495868/job/41297791515?pr=13885
author_association: COLLABORATOR
user: login: LordGvozd
created_at: 2025-05-07T20:26:39Z
body: Sorry, I'll try to fix it soon!
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-10T21:06:04Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-10T21:21:05Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-10T21:32:30Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-05-11T18:05:25Z
body: According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉
author_association: CONTRIBUTOR