Skip to content

Commit 512cf0f

Browse files
author
benjamin.peterson
committed
make destinsrc private
git-svn-id: http://svn.python.org/projects/python/trunk@69415 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 285511f commit 512cf0f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: Lib/shutil.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,15 @@ def move(src, dst):
256256
os.rename(src, real_dst)
257257
except OSError:
258258
if os.path.isdir(src):
259-
if destinsrc(src, dst):
259+
if _destinsrc(src, dst):
260260
raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)
261261
copytree(src, real_dst, symlinks=True)
262262
rmtree(src)
263263
else:
264264
copy2(src, real_dst)
265265
os.unlink(src)
266266

267-
def destinsrc(src, dst):
267+
def _destinsrc(src, dst):
268268
src = abspath(src)
269269
dst = abspath(dst)
270270
if not src.endswith(os.path.sep):

Diff for: Lib/test/test_shutil.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ def test_destinsrc_false_negative(self):
346346
for src, dst in [('srcdir', 'srcdir/dest')]:
347347
src = os.path.join(TESTFN, src)
348348
dst = os.path.join(TESTFN, dst)
349-
self.assert_(shutil.destinsrc(src, dst),
350-
msg='destinsrc() wrongly concluded that '
349+
self.assert_(shutil._destinsrc(src, dst),
350+
msg='_destinsrc() wrongly concluded that '
351351
'dst (%s) is not in src (%s)' % (dst, src))
352352
finally:
353353
shutil.rmtree(TESTFN, ignore_errors=True)
@@ -358,8 +358,8 @@ def test_destinsrc_false_positive(self):
358358
for src, dst in [('srcdir', 'src/dest'), ('srcdir', 'srcdir.new')]:
359359
src = os.path.join(TESTFN, src)
360360
dst = os.path.join(TESTFN, dst)
361-
self.failIf(shutil.destinsrc(src, dst),
362-
msg='destinsrc() wrongly concluded that '
361+
self.failIf(shutil._destinsrc(src, dst),
362+
msg='_destinsrc() wrongly concluded that '
363363
'dst (%s) is in src (%s)' % (dst, src))
364364
finally:
365365
shutil.rmtree(TESTFN, ignore_errors=True)

0 commit comments

Comments
 (0)