]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
check for superclasses of user defined init
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Feb 2023 15:16:26 +0000 (10:16 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 6 Feb 2023 15:16:26 +0000 (10:16 -0500)
commitb927d95d075c4cdf027f784e759c9904416fb73a
treebb4b370015f0a36e4b342976db7c443405dea925
parent44da56e573a1404dae48e6025b6fdb042bfc231c
check for superclasses of user defined init

Fixed regression caused by the fix for :ticket:`9171`, which itself was
fixing a regression, involving the mechanics of ``__init__()`` on classes
that extend from :class:`_orm.DeclarativeBase`. The change made it such
that ``__init__()`` was applied to the user-defined base if there were no
``__init__()`` method directly on the class. This has been adjusted so that
``__init__()`` is applied only if no other class in the hierarchy of the
user-defined base has an ``__init__()`` method. This again allows
user-defined base classes based on :class:`_orm.DeclarativeBase` to include
mixins that themselves include a custom ``__init__()`` method.

Fixes: #9249
Change-Id: I78f32590ce9ffe245eccb4bd5bd7c884d4e015d5
doc/build/changelog/unreleased_20/9249.rst [new file with mode: 0644]
lib/sqlalchemy/orm/decl_api.py
test/orm/declarative/test_basic.py