mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.18k stars 186 forks source link

Define empty __slots__ in base classes #598

Closed anton-ryzhov closed 7 months ago

anton-ryzhov commented 7 months ago

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

coveralls commented 7 months ago

Coverage Status

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

anton-ryzhov commented 7 months ago

Done