Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
569d0875
Commit
569d0875
authored
May 10, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use yield from
parent
e8751e05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
Lib/os.py
Lib/os.py
+3
-6
No files found.
Lib/os.py
View file @
569d0875
...
@@ -294,8 +294,7 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
...
@@ -294,8 +294,7 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
for
name
in
dirs
:
for
name
in
dirs
:
new_path
=
join
(
top
,
name
)
new_path
=
join
(
top
,
name
)
if
followlinks
or
not
islink
(
new_path
):
if
followlinks
or
not
islink
(
new_path
):
for
x
in
walk
(
new_path
,
topdown
,
onerror
,
followlinks
):
yield
from
walk
(
new_path
,
topdown
,
onerror
,
followlinks
)
yield
x
if
not
topdown
:
if
not
topdown
:
yield
top
,
dirs
,
nondirs
yield
top
,
dirs
,
nondirs
...
@@ -339,8 +338,7 @@ if _exists("openat"):
...
@@ -339,8 +338,7 @@ if _exists("openat"):
try
:
try
:
if
(
followlinks
or
(
st
.
S_ISDIR
(
orig_st
.
st_mode
)
and
if
(
followlinks
or
(
st
.
S_ISDIR
(
orig_st
.
st_mode
)
and
path
.
samestat
(
orig_st
,
fstat
(
topfd
)))):
path
.
samestat
(
orig_st
,
fstat
(
topfd
)))):
for
x
in
_fwalk
(
topfd
,
top
,
topdown
,
onerror
,
followlinks
):
yield
from
_fwalk
(
topfd
,
top
,
topdown
,
onerror
,
followlinks
)
yield
x
finally
:
finally
:
close
(
topfd
)
close
(
topfd
)
...
@@ -377,8 +375,7 @@ if _exists("openat"):
...
@@ -377,8 +375,7 @@ if _exists("openat"):
try
:
try
:
if
followlinks
or
path
.
samestat
(
orig_st
,
fstat
(
dirfd
)):
if
followlinks
or
path
.
samestat
(
orig_st
,
fstat
(
dirfd
)):
dirpath
=
path
.
join
(
toppath
,
name
)
dirpath
=
path
.
join
(
toppath
,
name
)
for
x
in
_fwalk
(
dirfd
,
dirpath
,
topdown
,
onerror
,
followlinks
):
yield
from
_fwalk
(
dirfd
,
dirpath
,
topdown
,
onerror
,
followlinks
)
yield
x
finally
:
finally
:
close
(
dirfd
)
close
(
dirfd
)
...
...
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