Fix TypeError when caching browse results with Sequence return type (#2657)
authorOzGav <gavnosp@hotmail.com>
Wed, 26 Nov 2025 18:55:43 +0000 (04:55 +1000)
committerGitHub <noreply@github.com>
Wed, 26 Nov 2025 18:55:43 +0000 (19:55 +0100)
music_assistant/helpers/api.py

index 2c382958adcffd7f12b8f933d1e17a7f3a3ea272..ddd240f93deefbd1fdd19054a8d7d7cde7603435 100644 (file)
@@ -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
             )