[bind10-dev] Close Python objects with underlying descriptors

Mukund Sivaraman muks at banu.com
Thu Jun 7 07:17:23 UTC 2012


Hi all

This message comes due to bug #1828.

CPython's standard library modules check during destruction (after last
unref) if we have performed an explicit .close() call on socket and
file objects.  I don't know the reason for it, but I suspect it could
be so that we do not rely on the behavior of CPython which makes the
extent of the object to end immediately when it goes out of scope
because its implementation is refcounted.  Some other implementations
such as PyPy may destroy the object at other times.  Not doing the
explicit close could cause resource exhaustion of descriptors in such
cases if there are too few configured.

In any case, because of this check done by CPython code, we should
always .close() any socket or file object when we're done using it. 
The coding guidelines wiki page has also been updated.

                Mukund
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 630 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120607/cdb0e9fd/attachment.bin>


More information about the bind10-dev mailing list