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 akrpic77
Recipients akrpic77
Date 2013-04-04.16:23:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365092598.25.0.167628873092.issue17634@psf.upfronthosting.co.za>
In-reply-to
Content
Function shutil.copy opens source file with open('rb') and destination file with open('wb') and then proceeds to copy the content.

If you create child process from the same python process during that time, that process will inherit open file handles.

This could lead to situation when parent process tries to delete the file, but child process prevents that by holding an open handle to the file (Windows XP, Windows 7).
 
This is not expected side effect for copy file operation.
Win32's native CopyFile API call doesn't leak file handles to child processes.

Python's open function behavior is defined by platform's implementation, which translates C function fopen with 'rb' and 'wb' modes to CRT open call without O_NOINHERIT flag, which creates inheritable Win32 HANDLEs.

Possible fix would be to add 'N' to mode string in calls to open function in shutil.copy.
History
Date User Action Args
2013-04-04 16:23:18akrpic77setrecipients: + akrpic77
2013-04-04 16:23:18akrpic77setmessageid: <1365092598.25.0.167628873092.issue17634@psf.upfronthosting.co.za>
2013-04-04 16:23:18akrpic77linkissue17634 messages
2013-04-04 16:23:17akrpic77create