From 0a1c8c3c7eb414aaec6d82a415b942eb92f07acb Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Sun, 27 Apr 2025 16:58:19 -0700 Subject: [PATCH 1/2] callable __or__ patch --- Lib/_collections_abc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py index aebe9c8b64..de624f2e54 100644 --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -512,6 +512,10 @@ def __getitem__(self, item): new_args = (t_args, t_result) return _CallableGenericAlias(Callable, tuple(new_args)) + # TODO: RUSTPYTHON patch for common call + def __or__(self, other): + super().__or__(other) + def _is_param_expr(obj): """Checks if obj matches either a list of types, ``...``, ``ParamSpec`` or ``_ConcatenateGenericAlias`` from typing.py From 159769876f99508ba79c266cabd8cedf354ba732 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Wed, 30 Apr 2025 11:14:21 -0700 Subject: [PATCH 2/2] add test --- extra_tests/snippets/stdlib_typing.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 extra_tests/snippets/stdlib_typing.py diff --git a/extra_tests/snippets/stdlib_typing.py b/extra_tests/snippets/stdlib_typing.py new file mode 100644 index 0000000000..ddc30b6846 --- /dev/null +++ b/extra_tests/snippets/stdlib_typing.py @@ -0,0 +1,10 @@ +from collections.abc import Awaitable, Callable +from typing import TypeVar + +T = TypeVar("T") + + +def abort_signal_handler( + fn: Callable[[], Awaitable[T]], on_abort: Callable[[], None] | None = None +) -> T: + pass