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
0bddc9eb
Kaydet (Commit)
0bddc9eb
authored
Ara 22, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #25860: os.fwalk() no longer skips remaining directories when error occurs.
Original patch by Samson Lee.
üst
0ce7a3a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
12 deletions
+24
-12
os.py
Lib/os.py
+1
-1
test_os.py
Lib/test/test_os.py
+20
-11
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/os.py
Dosyayı görüntüle @
0bddc9eb
...
@@ -514,7 +514,7 @@ if {open, stat} <= supports_dir_fd and {listdir, stat} <= supports_fd:
...
@@ -514,7 +514,7 @@ if {open, stat} <= supports_dir_fd and {listdir, stat} <= supports_fd:
except
OSError
as
err
:
except
OSError
as
err
:
if
onerror
is
not
None
:
if
onerror
is
not
None
:
onerror
(
err
)
onerror
(
err
)
return
continue
try
:
try
:
if
follow_symlinks
or
path
.
samestat
(
orig_st
,
stat
(
dirfd
)):
if
follow_symlinks
or
path
.
samestat
(
orig_st
,
stat
(
dirfd
)):
dirpath
=
path
.
join
(
toppath
,
name
)
dirpath
=
path
.
join
(
toppath
,
name
)
...
...
Lib/test/test_os.py
Dosyayı görüntüle @
0bddc9eb
...
@@ -791,12 +791,8 @@ class WalkTests(unittest.TestCase):
...
@@ -791,12 +791,8 @@ class WalkTests(unittest.TestCase):
# Wrapper to hide minor differences between os.walk and os.fwalk
# Wrapper to hide minor differences between os.walk and os.fwalk
# to tests both functions with the same code base
# to tests both functions with the same code base
def
walk
(
self
,
directory
,
topdown
=
True
,
follow_symlinks
=
False
):
def
walk
(
self
,
directory
,
**
kwargs
):
walk_it
=
os
.
walk
(
directory
,
return
os
.
walk
(
directory
,
**
kwargs
)
topdown
=
topdown
,
followlinks
=
follow_symlinks
)
for
root
,
dirs
,
files
in
walk_it
:
yield
(
root
,
dirs
,
files
)
def
setUp
(
self
):
def
setUp
(
self
):
join
=
os
.
path
.
join
join
=
os
.
path
.
join
...
@@ -926,16 +922,29 @@ class WalkTests(unittest.TestCase):
...
@@ -926,16 +922,29 @@ class WalkTests(unittest.TestCase):
os
.
remove
(
dirname
)
os
.
remove
(
dirname
)
os
.
rmdir
(
support
.
TESTFN
)
os
.
rmdir
(
support
.
TESTFN
)
def
test_walk_bad_dir
(
self
):
# Walk top-down.
errors
=
[]
walk_it
=
self
.
walk
(
self
.
walk_path
,
onerror
=
errors
.
append
)
root
,
dirs
,
files
=
next
(
walk_it
)
self
.
assertFalse
(
errors
)
dir1
=
dirs
[
0
]
dir1new
=
dir1
+
'.new'
os
.
rename
(
os
.
path
.
join
(
root
,
dir1
),
os
.
path
.
join
(
root
,
dir1new
))
roots
=
[
r
for
r
,
d
,
f
in
walk_it
]
self
.
assertTrue
(
errors
)
self
.
assertNotIn
(
os
.
path
.
join
(
root
,
dir1
),
roots
)
self
.
assertNotIn
(
os
.
path
.
join
(
root
,
dir1new
),
roots
)
for
dir2
in
dirs
[
1
:]:
self
.
assertIn
(
os
.
path
.
join
(
root
,
dir2
),
roots
)
@unittest.skipUnless
(
hasattr
(
os
,
'fwalk'
),
"Test needs os.fwalk()"
)
@unittest.skipUnless
(
hasattr
(
os
,
'fwalk'
),
"Test needs os.fwalk()"
)
class
FwalkTests
(
WalkTests
):
class
FwalkTests
(
WalkTests
):
"""Tests for os.fwalk()."""
"""Tests for os.fwalk()."""
def
walk
(
self
,
directory
,
topdown
=
True
,
follow_symlinks
=
False
):
def
walk
(
self
,
directory
,
**
kwargs
):
walk_it
=
os
.
fwalk
(
directory
,
for
root
,
dirs
,
files
,
root_fd
in
os
.
fwalk
(
directory
,
**
kwargs
):
topdown
=
topdown
,
follow_symlinks
=
follow_symlinks
)
for
root
,
dirs
,
files
,
root_fd
in
walk_it
:
yield
(
root
,
dirs
,
files
)
yield
(
root
,
dirs
,
files
)
...
...
Misc/NEWS
Dosyayı görüntüle @
0bddc9eb
...
@@ -28,6 +28,9 @@ Core and Builtins
...
@@ -28,6 +28,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #25860: os.fwalk() no longer skips remaining directories when error
occurs. Original patch by Samson Lee.
- Issue #25914: Fixed and simplified OrderedDict.__sizeof__.
- Issue #25914: Fixed and simplified OrderedDict.__sizeof__.
- Issue #25902: Fixed various refcount issues in ElementTree iteration.
- Issue #25902: Fixed various refcount issues in ElementTree iteration.
...
...
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