agoragames / haigha

AMQP Python client
BSD 3-Clause "New" or "Revised" License
160 stars 41 forks source link

Channel protocol class properties on closed channels #61

Open awestendorf opened 10 years ago

awestendorf commented 10 years ago

When a closed channel is accessed, the protocol classes are no longer bound, e.g. channel.basic. The reason for this is that they're cleaned up so that circular references can be quickly removed rather than waiting for the garbage collector.

One of the problems however is that the user has to either check for the closed state, or handle an ambiguous AttributeError, before calling channel.basic, etc. A better approach would be to replace the bindings with properties that raise the ChannelClosed exception on access.