1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
From: Colin Watson <cjwatson@debian.org>
Date: Sun, 6 Apr 2025 13:22:48 +0100
Subject: Handle typing_extensions.TypeAliasType != typing.TypeAliasType
Inspired by https://github.com/pydantic/pydantic-settings/pull/556,
although not directly backported as typing-inspection isn't yet in
Debian.
Bug-Debian: https://bugs.debian.org/1101859
Last-Update: 2025-04-06
---
pydantic_settings/sources.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pydantic_settings/sources.py b/pydantic_settings/sources.py
index cfbbac0..a49c915 100644
--- a/pydantic_settings/sources.py
+++ b/pydantic_settings/sources.py
@@ -1996,6 +1996,8 @@ class CliSettingsSource(EnvSettingsSource, Generic[T]):
return '...'
elif isinstance(obj, Representation):
return repr(obj)
+ elif hasattr(typing, 'TypeAliasType') and isinstance(obj, getattr(typing, 'TypeAliasType')):
+ return str(obj)
elif isinstance(obj, typing_extensions.TypeAliasType):
return str(obj)
|