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

#26117: Close directory descriptor in scandir iterator on error

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years ago by storchaka+cpython
Modified:
3 years, 11 months ago
Reviewers:
victor.stinner
CC:
gvanrossum, haypo, benhoyt, devnull_psf.upfronthosting.co.za, storchaka
Visibility:
Public.

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Modules/posixmodule.c View 6 chunks +20 lines, -19 lines 7 comments Download

Messages

Total messages: 3
victor.stinner_gmail.com
http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c File Modules/posixmodule.c (left): http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c#oldcode11988 Modules/posixmodule.c:11988: PyErr_SetNone(PyExc_StopIteration); It's not a requirement to raise StopIteration? http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c ...
3 years, 11 months ago #1
storchaka_gmail.com
Thank you for your review Victor. http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c File Modules/posixmodule.c (left): http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c#oldcode11988 Modules/posixmodule.c:11988: PyErr_SetNone(PyExc_StopIteration); On 2016/02/08 ...
3 years, 11 months ago #2
victor.stinner_gmail.com
3 years, 11 months ago #3
http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c
File Modules/posixmodule.c (left):

http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c#oldcode1...
Modules/posixmodule.c:11988: PyErr_SetNone(PyExc_StopIteration);
On 2016/02/08 16:05:09, storchaka wrote:
> On 2016/02/08 15:48:07, haypo wrote:
> > It's not a requirement to raise StopIteration?
> 
> It is not a requirement. The __next__() implementation can either raise
> StopIteration or just return NULL without error set. See also PyIter_Next(),
it
> clears StopIteration. Raising StopIteration here just wastes CPU time.

I didn't know, great!

http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c
File Modules/posixmodule.c (right):

http://bugs.python.org/review/26117/diff/16354/Modules/posixmodule.c#newcode1...
Modules/posixmodule.c:11988: 
/* Error or no more files */ is good enough if you put it here.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+