From: OzGav Date: Wed, 26 Nov 2025 18:55:43 +0000 (+1000) Subject: Fix TypeError when caching browse results with Sequence return type (#2657) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=3562a8a1d217e11f41c343cc18b9e290332507bf;p=music-assistant-server.git Fix TypeError when caching browse results with Sequence return type (#2657) --- 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 )