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
acdc56d0
Kaydet (Commit)
acdc56d0
authored
May 11, 2012
tarafından
Ned Deily
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14662: Prevent shutil failures on OS X when destination does not
support chflag operations. (Patch by Hynek Schlawack)
üst
b79a01f9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
2 deletions
+40
-2
shutil.py
Lib/shutil.py
+4
-2
test_shutil.py
Lib/test/test_shutil.py
+30
-0
NEWS
Misc/NEWS
+3
-0
errnomodule.c
Modules/errnomodule.c
+3
-0
No files found.
Lib/shutil.py
Dosyayı görüntüle @
acdc56d0
...
...
@@ -102,8 +102,10 @@ def copystat(src, dst):
try
:
os
.
chflags
(
dst
,
st
.
st_flags
)
except
OSError
,
why
:
if
(
not
hasattr
(
errno
,
'EOPNOTSUPP'
)
or
why
.
errno
!=
errno
.
EOPNOTSUPP
):
for
err
in
'EOPNOTSUPP'
,
'ENOTSUP'
:
if
hasattr
(
errno
,
err
)
and
why
.
errno
==
getattr
(
errno
,
err
):
break
else
:
raise
def
copy
(
src
,
dst
):
...
...
Lib/test/test_shutil.py
Dosyayı görüntüle @
acdc56d0
...
...
@@ -7,6 +7,7 @@ import sys
import
stat
import
os
import
os.path
import
errno
from
os.path
import
splitdrive
from
distutils.spawn
import
find_executable
,
spawn
from
shutil
import
(
_make_tarball
,
_make_zipfile
,
make_archive
,
...
...
@@ -339,6 +340,35 @@ class TestShutil(unittest.TestCase):
shutil
.
rmtree
(
TESTFN
,
ignore_errors
=
True
)
shutil
.
rmtree
(
TESTFN2
,
ignore_errors
=
True
)
@unittest.skipUnless
(
hasattr
(
os
,
'chflags'
)
and
hasattr
(
errno
,
'EOPNOTSUPP'
)
and
hasattr
(
errno
,
'ENOTSUP'
),
"requires os.chflags, EOPNOTSUPP & ENOTSUP"
)
def
test_copystat_handles_harmless_chflags_errors
(
self
):
tmpdir
=
self
.
mkdtemp
()
file1
=
os
.
path
.
join
(
tmpdir
,
'file1'
)
file2
=
os
.
path
.
join
(
tmpdir
,
'file2'
)
self
.
write_file
(
file1
,
'xxx'
)
self
.
write_file
(
file2
,
'xxx'
)
def
make_chflags_raiser
(
err
):
ex
=
OSError
()
def
_chflags_raiser
(
path
,
flags
):
ex
.
errno
=
err
raise
ex
return
_chflags_raiser
old_chflags
=
os
.
chflags
try
:
for
err
in
errno
.
EOPNOTSUPP
,
errno
.
ENOTSUP
:
os
.
chflags
=
make_chflags_raiser
(
err
)
shutil
.
copystat
(
file1
,
file2
)
# assert others errors break it
os
.
chflags
=
make_chflags_raiser
(
errno
.
EOPNOTSUPP
+
errno
.
ENOTSUP
)
self
.
assertRaises
(
OSError
,
shutil
.
copystat
,
file1
,
file2
)
finally
:
os
.
chflags
=
old_chflags
@unittest.skipUnless
(
zlib
,
"requires zlib"
)
def
test_make_tarball
(
self
):
# creating something to tar
...
...
Misc/NEWS
Dosyayı görüntüle @
acdc56d0
...
...
@@ -60,6 +60,9 @@ Core and Builtins
Library
-------
-
Issue
#
14662
:
Prevent
shutil
failures
on
OS
X
when
destination
does
not
support
chflag
operations
.
Patch
by
Hynek
Schlawack
.
-
Issue
#
14157
:
Fix
time
.
strptime
failing
without
a
year
on
February
29
th
.
Patch
by
Hynek
Schlawack
.
...
...
Modules/errnomodule.c
Dosyayı görüntüle @
acdc56d0
...
...
@@ -783,6 +783,9 @@ initerrno(void)
#ifdef WSAN
inscode
(
d
,
ds
,
de
,
"WSAN"
,
WSAN
,
"Error WSAN"
);
#endif
#ifdef ENOTSUP
inscode
(
d
,
ds
,
de
,
"ENOTSUP"
,
ENOTSUP
,
"Operation not supported"
);
#endif
Py_DECREF
(
de
);
}
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