From 3562a8a1d217e11f41c343cc18b9e290332507bf Mon Sep 17 00:00:00 2001 From: OzGav Date: Thu, 27 Nov 2025 04:55:43 +1000 Subject: [PATCH] Fix TypeError when caching browse results with Sequence return type (#2657) --- music_assistant/helpers/api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/music_assistant/helpers/api.py b/music_assistant/helpers/api.py index 2c382958..ddd240f9 100644 --- a/music_assistant/helpers/api.py +++ b/music_assistant/helpers/api.py @@ -5,7 +5,7 @@ from __future__ import annotations import importlib import inspect import logging -from collections.abc import AsyncGenerator, Callable, Coroutine +from collections.abc import AsyncGenerator, Callable, Coroutine, Iterable, Sequence from dataclasses import MISSING, dataclass from datetime import datetime from enum import Enum @@ -354,8 +354,10 @@ def parse_value( # noqa: PLR0911 if value is None and value_type is NoneType: return None origin = get_origin(value_type) - if origin in (tuple, list): - return origin( + if origin in (tuple, list, Sequence, Iterable): + # For abstract types like Sequence and Iterable, use list as the concrete type + concrete_type = list if origin in (Sequence, Iterable) else origin + return concrete_type( parse_value( name, subvalue, get_args(value_type)[0], allow_value_convert=allow_value_convert ) -- 2.34.1