]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
include cls locals in annotation evaluate
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Jan 2024 17:47:02 +0000 (12:47 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Feb 2024 00:39:10 +0000 (19:39 -0500)
commit153f287b9949462ec29d66fc9b329d0144a6ca7c
tree0fc18a6b8d8a0b8b9dbba3877d71c6400231ddb4
parent753f46fc0c03e0a1a405c72f529abc2249b8f583
include cls locals in annotation evaluate

Fixed issue where it was not possible to use a type (such as an enum)
within a :class:`_orm.Mapped` container type if that type were declared
locally within the class body.  The scope of locals used for the eval now
includes that of the class body itself.  In addition, the expression within
:class:`_orm.Mapped` may also refer to the class name itself, if used as a
string or with future annotations mode.

Fixes: #10899
Change-Id: Id4d07499558e457e63b483ff44c0972d9265409d
(cherry picked from commit e9a05cf88811c4c4ca51b8103539a7727630d2f0)
doc/build/changelog/unreleased_20/10899.rst [new file with mode: 0644]
lib/sqlalchemy/util/typing.py
test/orm/declarative/test_tm_future_annotations.py
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py