From 4af45109e073883f93128d7aab59d8428a3830dd Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Tue, 2 Sep 2025 18:01:55 -0400 Subject: [PATCH] handle 3.13 `GenericAlias` hint https://github.com/Chia-Network/chia-blockchain/blob/9a47aa2e3fc1bbefae9ce39c26b892310a9a14de/chia/wallet/wallet_request_types.py#L1139 --- chia/wallet/util/clvm_streamable.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/chia/wallet/util/clvm_streamable.py b/chia/wallet/util/clvm_streamable.py index 7849970783bb..855c3e6cc7f5 100644 --- a/chia/wallet/util/clvm_streamable.py +++ b/chia/wallet/util/clvm_streamable.py @@ -2,8 +2,8 @@ import dataclasses import functools -from types import MappingProxyType -from typing import Any, Callable, Generic, Optional, TypeVar, Union, get_args, get_type_hints +from types import GenericAlias, MappingProxyType +from typing import Any, Callable, Generic, Optional, TypeVar, Union, get_args, get_origin, get_type_hints from hsms.clvm_serde import from_program_for_type, to_program_for_type from typing_extensions import TypeGuard @@ -101,7 +101,11 @@ def is_compound_type(typ: Any) -> bool: # TODO: this is more than _just_ a Streamable, but it is also a Streamable and that's # useful for now def is_clvm_streamable_type(v: type[object]) -> TypeGuard[type[Streamable]]: - return issubclass(v, Streamable) and hasattr(v, "_clvm_streamable") + if isinstance(v, GenericAlias): + resolved = get_origin(v) + else: + resolved = v + return issubclass(resolved, Streamable) and hasattr(resolved, "_clvm_streamable") # TODO: this is more than _just_ a Streamable, but it is also a Streamable and that's