[Python-checkins] python/dist/src/Lib shutil.py,1.22,1.23
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sun, 08 Sep 2002 13:44:01 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv30326
Modified Files:
shutil.py
Log Message:
shutil.copyfile(src,dst) was clobbering the file when the src and dst were
the same. Added check to verify the two names are not the same. Does not
check the actual files to see if there is a symbolic link.
Closes SF bug 490165 and Tzot's patch 604600.
Index: shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** shutil.py 6 Jun 2002 09:48:13 -0000 1.22
--- shutil.py 8 Sep 2002 20:43:59 -0000 1.23
***************
*** 25,28 ****
--- 25,33 ----
fsrc = None
fdst = None
+ # check for same pathname; all platforms
+ _src = os.path.normcase(os.path.abspath(src))
+ _dst = os.path.normcase(os.path.abspath(dst))
+ if _src == _dst:
+ return
try:
fsrc = open(src, 'rb')