summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2023-05-04 12:54:18 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2023-05-04 12:54:18 +0000
commit3841c5c7ded5bc01a343439f2835e0b2056aeaa3 (patch)
treeade735351292a27bbd7314b287d292cb3f9eaad4
parentaebdc7cfdfc3263c6f407cf5fbb388e0370e2bc3 (diff)
parentd9be22044d251c047b6306e767b2537c0ee12709 (diff)
downloadsqlalchemy-3841c5c7ded5bc01a343439f2835e0b2056aeaa3.tar.gz
Merge "adjust fwd_ref logic" into main
-rw-r--r--doc/build/changelog/unreleased_20/9717.rst8
-rw-r--r--lib/sqlalchemy/util/typing.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_20/9717.rst b/doc/build/changelog/unreleased_20/9717.rst
new file mode 100644
index 000000000..d70ffe17a
--- /dev/null
+++ b/doc/build/changelog/unreleased_20/9717.rst
@@ -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.
diff --git a/lib/sqlalchemy/util/typing.py b/lib/sqlalchemy/util/typing.py
index 9c38ae344..3ac67aad9 100644
--- a/lib/sqlalchemy/util/typing.py
+++ b/lib/sqlalchemy/util/typing.py
@@ -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):