]> 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:38:04 +0000 (19:38 -0500)
commite9a05cf88811c4c4ca51b8103539a7727630d2f0
tree5c95ea62183ed022eb06e06f9e83bc520335a4ce
parent822703b7c67fe59ad6d2bf2bca7002cd7153a85d
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
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