Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3060)

#15177: Support os.walk(dir_fd=) and os.fwalk(dir_fd=)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 months ago by larry
Modified:
11 months ago
Reviewers:
georg, storchaka
CC:
Georg, AntoinePitrou, larry, arfrever.fta_gmail.com, Charles-François Natali, devnull_psf.upfronthosting.co.za, hynek
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 2

Patch Set 3 #

Patch Set 4 #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/os.rst View 1 2 3 1 chunk +5 lines, -2 lines 2 comments Download
Lib/os.py View 1 2 3 5 chunks +51 lines, -17 lines 6 comments Download
Lib/test/test_os.py View 1 2 3 5 chunks +117 lines, -80 lines 0 comments Download

Messages

Total messages: 4
Georg
http://bugs.python.org/review/15177/diff/5233/Lib/os.py File Lib/os.py (right): http://bugs.python.org/review/15177/diff/5233/Lib/os.py#newcode519 Lib/os.py:519: supports_dir_fd.add(fwalk) Please don't add this. It doesn't make any ...
11 months ago #1
larry
http://bugs.python.org/review/15177/diff/5233/Lib/os.py File Lib/os.py (right): http://bugs.python.org/review/15177/diff/5233/Lib/os.py#newcode519 Lib/os.py:519: supports_dir_fd.add(fwalk) On 2012/06/25 10:43:12, Georg wrote: > Please don't ...
11 months ago #2
storchaka
http://bugs.python.org/review/15177/diff/5238/Doc/library/os.rst File Doc/library/os.rst (right): http://bugs.python.org/review/15177/diff/5238/Doc/library/os.rst#newcode2218 Doc/library/os.rst:2218: ``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``. But ...
11 months ago #3
larry
11 months ago #4
This isn't happening for 3.3 anyway, but maybe it'll go in for 3.4.  (I'll talk
to the 3.4 RM.)

http://bugs.python.org/review/15177/diff/5238/Doc/library/os.rst
File Doc/library/os.rst (right):

http://bugs.python.org/review/15177/diff/5238/Doc/library/os.rst#newcode2218
Doc/library/os.rst:2218: ``(dirpath, dirnames, filenames, dirfd)``, and it
supports ``dir_fd``.
On 2012/06/25 14:08:10, storchaka wrote:
> But walk also supports dir_fd.
Wishful thinking for now ;-) but, Done.

http://bugs.python.org/review/15177/diff/5238/Lib/os.py
File Lib/os.py (right):

http://bugs.python.org/review/15177/diff/5238/Lib/os.py#newcode341
Lib/os.py:341: return False
On 2012/06/25 14:08:10, storchaka wrote:
> Should onerror handler be used?

I have a much better implementation, so this one is best forgotten.  The new
implementation is just seven lines right at the top of os.walk, and looks
basically like this:

if they pass in dir_fd:
  if fwalk is unavailable
     throw NotImplementedError
  for tuple in fwalk(args):
     yield tuple[:-1]
  return

http://bugs.python.org/review/15177/diff/5238/Lib/os.py#newcode419
Lib/os.py:419: close(close_me)
On 2012/06/25 14:08:10, storchaka wrote:
> What if error happens on close?
Obviated by new implementation.

http://bugs.python.org/review/15177/diff/5238/Lib/os.py#newcode446
Lib/os.py:446: if followlinks or not islink(new_path):
On 2012/06/25 14:08:10, storchaka wrote:
> st.S_ISLINK(stat(name, dir_fd=close_me).st_mode) ?
Obviated by new implementation.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7