Describe the bug
Quite a few classes define __slots__, but have bases where __slots__ is not defined:
ERROR: 'sqlalchemy.engine.base.Transaction' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.interfaces.ORMOption' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.strategies.ImmediateLoader' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.strategies.SelectInLoader' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.strategies.SubqueryLoader' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.unitofwork.Preprocess' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.orm.unitofwork.ProcessAll' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.sql.base.ImmutableColumnCollection' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.sql.coercions.ByOfImpl' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.sql.compiler._CompileLabel' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.sql.roles.ExecutableOptionRole' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.sql.traversals.TraversalComparatorStrategy' has slots but inherits from non-slot class
ERROR: 'sqlalchemy.util._collections.ImmutableProperties' has slots but inherits from non-slot class
"slotless" base classes causing this:
- sqlalchemy.engine.util.TransactionalContext
- sqlalchemy.orm.strategies.PostLoader
- sqlalchemy.orm.unitofwork.IterateMappersMixin
- sqlalchemy.sql.annotation.SupportsAnnotations
- sqlalchemy.sql.annotation.SupportsWrappingAnnotations
- sqlalchemy.sql.base.ExecutableOption
- sqlalchemy.sql.elements.ClauseElement
- sqlalchemy.sql.elements.ColumnElement
- sqlalchemy.sql.roles.AllowsLambdaRole
- sqlalchemy.sql.roles.BinaryElementRole
- sqlalchemy.sql.roles.ByOfRole
- sqlalchemy.sql.roles.ColumnArgumentOrKeyRole
- sqlalchemy.sql.roles.ColumnArgumentRole
- sqlalchemy.sql.roles.ColumnListRole
- sqlalchemy.sql.roles.ColumnsClauseRole
- sqlalchemy.sql.roles.DDLConstraintColumnRole
- sqlalchemy.sql.roles.DDLExpressionRole
- sqlalchemy.sql.roles.DMLColumnRole
- sqlalchemy.sql.roles.ExpressionElementRole
- sqlalchemy.sql.roles.LimitOffsetRole
- sqlalchemy.sql.roles.OnClauseRole
- sqlalchemy.sql.roles.OrderByRole
- sqlalchemy.sql.roles.SQLRole
- sqlalchemy.sql.roles.StatementOptionRole
- sqlalchemy.sql.roles.StructuralRole
- sqlalchemy.sql.roles.UsesInspection
- sqlalchemy.sql.roles.WhereHavingRole
- sqlalchemy.sql.traversals.HasCopyInternals
- sqlalchemy.sql.traversals.MemoizedHasCacheKey
- sqlalchemy.sql.visitors.InternalTraversal
- sqlalchemy.sql.visitors.Traversible
- sqlalchemy.util._collections.ImmutableContainer
To Reproduce
>>> # just an example of one of the classes with ineffective __slots__
>>> from sqlalchemy.orm.interfaces import ORMOption
>>> ORMOption().__dict__
{}
Error
There should not be a __dict__ on properly __slot__ed classes.
Versions
- OS: MacOS
- Python: 3.10
- SQLAlchemy: 1.4.29
- Database: n/a
- DBAPI (eg: psycopg, cx_oracle, mysqlclient): n/a
Additional context
If you agree, I'd like to investigate and fix this.
Describe the bug
Quite a few classes define
__slots__, but have bases where__slots__is not defined:"slotless" base classes causing this:
To Reproduce
Error
There should not be a
__dict__on properly__slot__ed classes.Versions
Additional context
If you agree, I'd like to investigate and fix this.