diff options
author | Arie Bovenberg <a.c.bovenberg@gmail.com> | 2022-02-01 15:08:19 -0500 |
---|---|---|
committer | sqla-tester <sqla-tester@sqlalchemy.org> | 2022-02-01 15:08:19 -0500 |
commit | 0409c88c297efa324218340b265a8d107d57deee (patch) | |
tree | 2337be6a74df17bd189a89a4c21254a50ed2d8ad /lib/sqlalchemy/sql/visitors.py | |
parent | d6046f5fcf3732df1a8a08274501efcffc6253f2 (diff) | |
download | sqlalchemy-0409c88c297efa324218340b265a8d107d57deee.tar.gz |
Fix overlapping slots, base classes without slots
Some `__slots__` were not in order.
Fixes #7527
### Description
I'm fixing two types of slots mistakes:
- [x] remove overlapping slots (i.e. slots already defined on a base class)
- [x] fix broken inheritance (i.e. slots class inheriting from a non-slots class)
- [x] slots added to base class `TransactionalContext`. It seemed to use two attributes, which I've added as slots.
- [x] empty slots removed from `ORMOption`. Its base class explicitly makes use of `__dict__` so empty slots don't add anything.
- [x] empty slots added to `PostLoader`. It doesn't appear to use any slots not already defined on its base classes.
- [x] empty slots added to `IterateMappersMixin`. It doesn't appear to use any slots not already defined on its subclasses.
- [x] empty slots added to `ImmutableContainer`. It doesn't use any fields.
- [x] empty slots added to `OperatorType`. It's a protocol.
- [x] empty slots added to `InternalTraversal`, `_HasTraversalDispatch`. They don't seem to use attributes on their own.
### Checklist
This pull request is:
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
**Have a nice day!**
Closes: #7589
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7589
Pull-request-sha: 70a9c4d46916b7c6907eb1d3ad4f7033ec964191
Change-Id: I6c6e3e69c3c34d0f3bdda7f0684849834fdd1863
Diffstat (limited to 'lib/sqlalchemy/sql/visitors.py')
-rw-r--r-- | lib/sqlalchemy/sql/visitors.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 78384782b..640c07d61 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -184,6 +184,8 @@ class _HasTraversalDispatch: """ + __slots__ = () + def __init_subclass__(cls) -> None: cls._generate_traversal_dispatch() super().__init_subclass__() @@ -299,6 +301,8 @@ class InternalTraversal(_HasTraversalDispatch): """ + __slots__ = () + dp_has_cache_key = symbol("HC") """Visit a :class:`.HasCacheKey` object.""" @@ -504,6 +508,8 @@ class ExtendedInternalTraversal(InternalTraversal): """ + __slots__ = () + dp_ignore = symbol("IG") """Specify an object that should be ignored entirely. |