Transport.close()
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Sep 22 14:04:29 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrew Bennetts wrote:
> Aaron Bentley wrote:
>
>>But if it just decrements a reference count, it seems a bit silly,
>>because Transports are already reference-counted.
>
>
> If you're referring to the reference counting CPython does already as part of
> its garbage collection, it's not good enough.
I really only meant that it seems silly. It may not actually *be* silly.
> There's no way to definitely disconnect a transport that you know you are done
> with, because perhaps there's another reference to it somewhere by accident.
I think this is also true with multiple transports that share a
connection, though not on the same scale.
> If the only way to signal "I'm done with you" to a transport is to drop your
> reference to it, then it's very difficult to write tests about transport
> disconnection behaviour.
Okay, I'm sold on the idea that Python refcounting won't solve it.
> I agree that there's no easy answer (e.g. because multiple transport objects can
> share connections) but the status quo is inadequate.
Well, it seems like dropping another transport's connection is
anti-social. Maybe it should raise an exception if the connection is
shared? Because I think if Transport.close() is useful, it's useful
because it acts right away. So making it just decrement a reference
count seems not useful, and may indicate programmer error.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFFE99c0F+nu1YWqI0RAomcAJ0Rjf7WWn2f9IISNv/FC/8pHxdszgCfQ5M5
DJZCDIzFh/tjeaOYsb+gspo=
=rdVW
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list