Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
78349b06
Kaydet (Commit)
78349b06
authored
May 06, 2011
tarafından
Ronald Oussoren
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge from 3.1
üst
8cd2e5f7
f51738b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
shutil.py
Lib/shutil.py
+7
-1
test_shutil.py
Lib/test/test_shutil.py
+18
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/shutil.py
Dosyayı görüntüle @
78349b06
...
@@ -311,12 +311,18 @@ def move(src, dst):
...
@@ -311,12 +311,18 @@ def move(src, dst):
"""
"""
real_dst
=
dst
real_dst
=
dst
if
os
.
path
.
isdir
(
dst
):
if
os
.
path
.
isdir
(
dst
):
if
_samefile
(
src
,
dst
):
# We might be on a case insensitive filesystem,
# perform the rename anyway.
os
.
rename
(
src
,
dst
)
return
real_dst
=
os
.
path
.
join
(
dst
,
_basename
(
src
))
real_dst
=
os
.
path
.
join
(
dst
,
_basename
(
src
))
if
os
.
path
.
exists
(
real_dst
):
if
os
.
path
.
exists
(
real_dst
):
raise
Error
(
"Destination path '
%
s' already exists"
%
real_dst
)
raise
Error
(
"Destination path '
%
s' already exists"
%
real_dst
)
try
:
try
:
os
.
rename
(
src
,
real_dst
)
os
.
rename
(
src
,
real_dst
)
except
OSError
:
except
OSError
as
exc
:
if
os
.
path
.
isdir
(
src
):
if
os
.
path
.
isdir
(
src
):
if
_destinsrc
(
src
,
dst
):
if
_destinsrc
(
src
,
dst
):
raise
Error
(
"Cannot move a directory '
%
s' into itself '
%
s'."
%
(
src
,
dst
))
raise
Error
(
"Cannot move a directory '
%
s' into itself '
%
s'."
%
(
src
,
dst
))
...
...
Lib/test/test_shutil.py
Dosyayı görüntüle @
78349b06
...
@@ -951,6 +951,24 @@ class TestCopyFile(unittest.TestCase):
...
@@ -951,6 +951,24 @@ class TestCopyFile(unittest.TestCase):
self
.
assertTrue
(
srcfile
.
_exited_with
[
0
]
is
None
)
self
.
assertTrue
(
srcfile
.
_exited_with
[
0
]
is
None
)
self
.
assertTrue
(
srcfile
.
_raised
)
self
.
assertTrue
(
srcfile
.
_raised
)
def
test_move_dir_caseinsensitive
(
self
):
# Renames a folder to the same name
# but a different case.
self
.
src_dir
=
tempfile
.
mkdtemp
()
dst_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
self
.
src_dir
),
os
.
path
.
basename
(
self
.
src_dir
)
.
upper
())
self
.
assertNotEqual
(
self
.
src_dir
,
dst_dir
)
try
:
shutil
.
move
(
self
.
src_dir
,
dst_dir
)
self
.
assertTrue
(
os
.
path
.
isdir
(
dst_dir
))
finally
:
if
os
.
path
.
exists
(
dst_dir
):
os
.
rmdir
(
dst_dir
)
def
test_main
():
def
test_main
():
support
.
run_unittest
(
TestShutil
,
TestMove
,
TestCopyFile
)
support
.
run_unittest
(
TestShutil
,
TestMove
,
TestCopyFile
)
...
...
Misc/NEWS
Dosyayı görüntüle @
78349b06
...
@@ -596,6 +596,10 @@ Library
...
@@ -596,6 +596,10 @@ Library
and a non-zero offset, and an attempt to read past the end of file is made
and a non-zero offset, and an attempt to read past the end of file is made
(IndexError is raised instead). Patch by Ross Lagerwall.
(IndexError is raised instead). Patch by Ross Lagerwall.
- Issue #10684: shutil.move used to delete a folder on case insensitive
filesystems when the source and destination name where the same except
for the case.
- Issue #10907: Warn OS X 10.6 IDLE users to use ActiveState Tcl/Tk 8.5, rather
- Issue #10907: Warn OS X 10.6 IDLE users to use ActiveState Tcl/Tk 8.5, rather
than the currently problematic Apple-supplied one, when running with the
than the currently problematic Apple-supplied one, when running with the
64-/32-bit installer variant.
64-/32-bit installer variant.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment