]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
adjust fwd_ref logic
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Apr 2023 03:00:18 +0000 (23:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Apr 2023 13:47:37 +0000 (09:47 -0400)
Fixed issue where ORM Annotated Declarative would not resolve forward
references correctly in all cases; in particular, when using
``from __future__ import annotations`` in combination with Pydantic
dataclasses.

Change-Id: If643c9a4ac7e217d4cb3a7d09b96cfd49432c44e
References: #9717

doc/build/changelog/unreleased_20/9717.rst [new file with mode: 0644]
lib/sqlalchemy/util/typing.py

diff --git a/doc/build/changelog/unreleased_20/9717.rst b/doc/build/changelog/unreleased_20/9717.rst
new file mode 100644 (file)
index 0000000..d70ffe1
--- /dev/null
@@ -0,0 +1,8 @@
+.. change::
+    :tags: bug, orm
+    :tickets: 9717
+
+    Fixed issue where ORM Annotated Declarative would not resolve forward
+    references correctly in all cases; in particular, when using
+    ``from __future__ import annotations`` in combination with Pydantic
+    dataclasses.
index 9c38ae34435fa38abe7e1c93feba16c4c868d79f..3ac67aad9afc622b2bb7e94cfc008edd881ca545 100644 (file)
@@ -146,7 +146,7 @@ def de_stringify_annotation(
 
     original_annotation = annotation
 
-    if is_fwd_ref(annotation) and not annotation.__forward_evaluated__:
+    if is_fwd_ref(annotation):
         annotation = annotation.__forward_arg__
 
     if isinstance(annotation, str):