From 5bae4b4e75d7727511dffa73e34f77e70ca39136 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 21 May 2024 09:53:35 +0200 Subject: [PATCH] Add Todo for get_type_hints fix in Python 3.12.4 --- homeassistant/helpers/config_validation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 81ac10f86cc838..52058ac4593a62 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -1,7 +1,8 @@ """Helpers for config validation using voluptuous.""" # PEP 563 seems to break typing.get_type_hints when used -# with PEP 695 syntax. Fixed in Python 3.13. +# with PEP 695 syntax. Fixed in Python 3.12.4. +# https://github.com/python/cpython/issues/114053 # from __future__ import annotations from collections.abc import Callable, Hashable, Mapping @@ -354,7 +355,7 @@ def ensure_list[_T](value: _T | None) -> list[_T] | list[Any]: """Wrap value in list if it is not one.""" if value is None: return [] - return cast("list[_T]", value) if isinstance(value, list) else [value] + return cast(list[_T], value) if isinstance(value, list) else [value] def entity_id(value: Any) -> str: