[issue10855] wave.Wave_read.close() doesn't release file

2012-11-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10855] wave.Wave_read.close() doesn't release file

2012-11-25 Thread Georg Brandl
Georg Brandl added the comment: I say "fixed": there was a bug (undocumented, but correct behavior) and that was fixed. -- resolution: rejected -> fixed status: open -> closed ___ Python tracker __

[issue10855] wave.Wave_read.close() doesn't release file

2012-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure, should this issue be closed as "rejected" because the suggested patch for Lib/wave.py was rejected, or as "fixed" because Georg was committed the documentation patch (changeset 8239ec6f39e6) for this issue? -- nosy: +serhiy.storchaka s

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > It allows garbage collection to close the file object if there are no > more references to it. This is a very bad policy to begin with. Garbage collection can be delayed for a number of reasons: - someone might be running your program on a Python implementa

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-12 Thread Peter Creath
Peter Creath added the comment: 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 im

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Agreed with Georg. No OS resource is leaking if the file is explicitly closed (since it releases the underlying file descriptor). That the Python "file object" is still attached somewhere is of secondary importance. -- nosy: +pitrou _

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-12 Thread Georg Brandl
Georg Brandl added the comment: I don't really see the bug here. Either you openened the file object, then you have to close it. Or wave.py opened it, then it will close it, no matter if it still has a reference or not. Of course we could set _data_chunk to None, but I'm unsure what behavio

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-12 Thread Peter Creath
Peter Creath added the comment: Thank you for clarifying the documentation. However, I don't think that fully resolves the issue. I'm not complaining about a failure to close the file. As you observe, it doesn't need to (and shouldn't) close a file object, but it should release the referen

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-08 Thread Georg Brandl
Georg Brandl added the comment: This is not a bug in the implementation: the file object is only closed when you passed a file name to open(). Like other APIs that allow file names or objects to be passed in, it is the caller's responsibility to close the file object if an object was passed.

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-07 Thread Ned Deily
Ned Deily added the comment: (Presumably this is also a problem for Python 3, as well). -- versions: +Python 3.2 ___ Python tracker ___ _

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-07 Thread Ned Deily
Ned Deily added the comment: Thanks for the report and analysis. Would you care to submit a patch to fix it? -- nosy: +ned.deily stage: -> unit test needed ___ Python tracker

[issue10855] wave.Wave_read.close() doesn't release file

2011-01-07 Thread Peter Creath
New submission from Peter Creath : Calling wave.close() fails to release all references to the file passed in via wave.open(filename_or_obj, "rb"). As a result, processing many wave files produces an IOError of too many files open. This bug is often masked because this dangling reference is c