This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pjcreath
Recipients georg.brandl, ned.deily, pitrou, pjcreath
Date 2011-01-12.20:16:44
SpamBayes Score 7.612633e-12
Marked as misclassified No
Message-id <1294863419.9.0.754318276391.issue10855@psf.upfronthosting.co.za>
In-reply-to
Content
A point of clarification on the original report: Georg is completely right when he points out that this is only an issue when passing in a file object.  If passed a filename, wave.py both opens and closes the file explicitly, and the dangling reference isn't important, as Antoine observes.

However, a retained reference in the file-object case is still a leak.

Georg writes: "Of course we could set _data_chunk to None, but I'm unsure what behavior change you would expect from that."

It allows garbage collection to close the file object if there are no more references to it.  It seems reasonable for a client of wave.py to assume that close() will release all references to the object, and indeed the code seems to support that assumption -- it sets _file to None.

If releasing references were truly of no importance, then I would argue that the line setting _file to None should be removed.  It serves no purpose after wave.py has explicitly closed the file (if it opened it) other than to release a reference to the file object.

Therefore, I suggest that _data_chunk should also be set to None in order to release the reference completely, thereby allowing the file object to be garbage collected.
History
Date User Action Args
2011-01-12 20:16:59pjcreathsetrecipients: + pjcreath, georg.brandl, pitrou, ned.deily
2011-01-12 20:16:59pjcreathsetmessageid: <1294863419.9.0.754318276391.issue10855@psf.upfronthosting.co.za>
2011-01-12 20:16:44pjcreathlinkissue10855 messages
2011-01-12 20:16:44pjcreathcreate