Message228751
Attaching my first patch here. It includes docs, the implementation of scandir and DirEntry in posixmodule.c, and tests in test_scandir.py. It does not yet include the changes for os.walk() to use scandir; I'm hoping to do that in a separate patch for easier code review.
I'd love some code and documentation review, as well as some thoughts on these open questions:
1) posixmodule.c is getting kinda huge and unwieldy; it'd be nice to implement this in a separate C file, but that comes with its own problems, as several functions would need to be made available externally.
2) While writing the tests, I was getting issues with Windows (apparently) not deleting the symlinks immediately in my teardown function, so for the moment I just don't call the teardown function at all. Not great; I think we'll want a better solution.
3) Partly due to #2, I haven't yet added tests for the file-not-found condition if a file is found by the directory scanning but then deleted before a DirEntry.is_dir() or DirEntry.is_file() call. I intend to add these tests, and there's a TODO comment in test_scandir.py so I remember.
4) test_scandir.py will need some further cleanup for inclusion in CPython; it's currently taken straight from my scandir module, which supports Python down to Python 2.6. |
|
Date |
User |
Action |
Args |
2014-10-07 01:21:15 | benhoyt | set | recipients:
+ benhoyt, pitrou, vstinner, giampaolo.rodola, tim.golden, abacabadabacaba, socketpair |
2014-10-07 01:21:14 | benhoyt | set | messageid: <1412644874.4.0.621974615654.issue22524@psf.upfronthosting.co.za> |
2014-10-07 01:21:14 | benhoyt | link | issue22524 messages |
2014-10-07 01:21:13 | benhoyt | create | |
|