Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define empty __slots__ in base classes #598

Merged
merged 2 commits into from Nov 21, 2023

Conversation

anton-ryzhov
Copy link
Contributor

I've noticed that __slots__ are defined in Message-classes, but they were not working as expected.

When inheriting from a class without slots, the dict and weakref attribute of the instances will always be accessible.

https://docs.python.org/3/reference/datamodel.html?#object.__slots__

So all parent classes must also have __slots__ to disable __dict__ creation. That's what I did in this PR

@anton-ryzhov anton-ryzhov marked this pull request as ready for review November 13, 2023 21:56
@coveralls
Copy link

coveralls commented Nov 14, 2023

Coverage Status

coverage: 88.434% (+0.03%) from 88.402%
when pulling c4d59b1 on anton-ryzhov:define-slots
into 3352ce4 on mosquito:master.

@mosquito mosquito requested a review from decaz November 16, 2023 10:11
mosquito
mosquito previously approved these changes Nov 16, 2023
Copy link
Collaborator

@decaz decaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anton-ryzhov can you add __slots__ for parent classes of RobustQueue which also has this attribute, please?

@anton-ryzhov
Copy link
Contributor Author

Done

@mosquito mosquito merged commit 10919d2 into mosquito:master Nov 21, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants