From: Mike Bayer Date: Tue, 8 Mar 2022 23:38:11 +0000 (-0500) Subject: add note about slots=True for attrs X-Git-Tag: rel_1_4_33~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb665d52ef0f756783754618d87a9f47cde6af81;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add note about slots=True for attrs Fixes: #7802 Change-Id: Ic5fadd369a0b63309cd9c44798ee5395efdbab2b (cherry picked from commit e790b11460ffaf8cc68b309ad47fe0e314b2c67f) --- diff --git a/doc/build/orm/declarative_styles.rst b/doc/build/orm/declarative_styles.rst index 2b4178a856..284e5a1e61 100644 --- a/doc/build/orm/declarative_styles.rst +++ b/doc/build/orm/declarative_styles.rst @@ -480,5 +480,12 @@ A mapping using ``@attr.s``, in conjunction with imperative table:: with the :meth:`_orm.registry.map_imperatively` function. See the section :ref:`orm_imperative_dataclasses` for a similar example. +.. note:: The ``attrs`` ``slots=True`` option, which enables ``__slots__`` on + a mapped class, cannot be used with SQLAlchemy mappings without fully + implementing alternative + :ref:`attribute instrumentation `, as mapped + classes normally rely upon direct access to ``__dict__`` for state storage. + Behavior is undefined when this option is present. + .. _dataclasses: https://docs.python.org/3/library/dataclasses.html .. _attrs: https://pypi.org/project/attrs/