Description of problem: It's not always possible to tell if there is a dangling reference to the libguestfs handle somewhere in a program. In order to ensure that the handle is really closed, it's a good idea to have an explicit close call. Perl, Ruby and OCaml bindings already have this. Version-Release number of selected component (if applicable): libguestfs 1.11.12 How reproducible: Always. Steps to Reproduce: Compare the following programs and their output: $ python -c 'import guestfs; g = guestfs.GuestFS(); g.set_trace(1); del g; print "ok"' libguestfs: trace: close ok $ python -c 'import guestfs; g = guestfs.GuestFS(); g.set_trace(1); g2 = g; del g; print "ok"' ok libguestfs: trace: close
Fix included in libguestfs git: http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=8c5bdc3e12947580e91c018b71adf9ad3128bb75 To close the handle explicitly in a way which will work with older versions of libguestfs too, do: try: g.close() except AttributeError: pass del g