[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-05 Thread STINNER Victor
STINNER Victor added the comment: Wow, nice trick (shutil.open = func) :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-05 Thread Tarek Ziadé
Tarek Ziadé added the comment: committed in r80830, r80831, r80833 and r80835 Thanks all ! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker _

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-05 Thread Tres Seaver
Tres Seaver added the comment: This patch adds tests for the four edge cases (opening source fails, opening dest fails, closing dest fails, closing source fails). -- Added file: http://bugs.python.org/file17229/issue4265-test_copyfile_exceptions.patch

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-05 Thread Ammon Riley
Ammon Riley added the comment: You can replace the built-in open(), with one of your own devising: >>> import shutil >>> def open(*a, **k): ... raise IOError("faked error.") ... >>> __builtins__.open = open >>> shutil.copyfile("snake", "egg") Traceback (most recent

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-05 Thread Tres Seaver
Tres Seaver added the comment: I would be glad to write those tests, if you could explain the strategy you have in mind more fully: since 'shutil.copyfile' performs the 'open' itself, I couldn't figure out how to stub in such a mocked up file. Does 'open' provide a hook for testing purposes

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-04 Thread STINNER Victor
STINNER Victor added the comment: Could you write a test? Use a fake file objects that raise (or not) an IOError on close(), and then check that close() was closed on both files. There are 4 cases: input.close() raises or not an exception, output.close() raises or not an exception. -

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-04 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-02 Thread Tarek Ziadé
Changes by Tarek Ziadé : -- assignee: -> tarek nosy: +tarek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-02 Thread Tres Seaver
Tres Seaver added the comment: The patch doesn't apply cleanly to trunk. Attached is one which does. -- Added file: http://bugs.python.org/file17186/issue4265_shutil_copyfile-trunk.patch ___ Python tracker __

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-02 Thread Tres Seaver
Changes by Tres Seaver : -- versions: +Python 2.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-02 Thread Tres Seaver
Tres Seaver added the comment: This bug exists on Python 2.6, too. It seems to me that the right solution here is to use both opened files as context managers. See attached patch (made against the release26-maint branch). The patch also cleans up the old-style exception signature in the prec

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2008-12-27 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +pitrou priority: -> normal stage: -> patch review versions: +Python 2.7, Python 3.1 -Python 2.5 ___ Python tracker ___

[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2008-11-05 Thread Ammon Riley
New submission from Ammon Riley <[EMAIL PROTECTED]>: If the disk fills up during the copy operation, shutil.copyfile() leaks file descriptors. The problem is the order of the close() statements in the finally block. In the event the copy operation runs out of disk space, the fdst.close() call t