]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
base all_orm_descriptors ordering on cls.__dict__ + cls.__mro__
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 6 Aug 2020 19:53:17 +0000 (15:53 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 6 Aug 2020 21:13:04 +0000 (17:13 -0400)
commit4f19f1823cfb1bb41af4c5ef7bf84b001778a8ab
tree333167a578318330c1aff08907ca8a1818a18ae7
parent2eaf2a978570420603da3397dae503184b68466c
base all_orm_descriptors ordering on cls.__dict__ + cls.__mro__

Adjusted the workings of the :meth:`_orm.Mapper.all_orm_descriptors`
accessor to represent the attributes in the order that they are located in
a deterministic way, assuming the use of Python 3.6 or higher which
maintains the sorting order of class attributes based on how they were
declared.   This sorting is not guaranteed to match the declared order of
attributes in all cases however; see the method documentation for the exact
scheme.

Fixes: #5494
Change-Id: I6ee8d4ace3eb8b3f7c9c0f2a3d7e27b5f62abfd3
(cherry picked from commit 9a3fee2cb6b608eb5c0263cf5a7e9085f74f2e73)
doc/build/changelog/unreleased_13/5494.rst [new file with mode: 0644]
lib/sqlalchemy/orm/instrumentation.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/testing/requirements.py
test/orm/test_inspect.py