homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author socketpair
Recipients Trundle, giampaolo.rodola, loewis, neologix, nvetoshkin, pitrou, socketpair
Date 2011年03月07日.19:43:54
SpamBayes Score 5.191209e-06
Marked as misclassified No
Message-id <1299527036.3.0.913790438649.issue11406@psf.upfronthosting.co.za>
In-reply-to
Content
> Glibc's readdir() and readdir_r() already do caching
Yes, but glibc's readdir is the C analogue of python's generator. We do not need to create cache for cached values.
I think it's OK to make python's generator on top of readdir (instead of getdents).
Why not to create generator like this?
(pseudocode)
------------------
DIR *d;
struct dirent* entry, *e;
entry = malloc(offsetof(struct dirent, d_name) + pathconf(dirpath, _PC_NAME_MAX) + 1);
if (!e)
 raise Exception();
if (!(d= opendir(dirname)))
{
 free(e)
 raise IOException();
}
for (;;)
{
 if (readdir_r(d, entry, &e))
 {
 closedir(d);
 free(entry);
 raise IOException();
 }
 if (!e)
 break;
 yield e;
}
closedir(d);
free(entry);
------------------
History
Date User Action Args
2011年03月07日 19:43:56socketpairsetrecipients: + socketpair, loewis, pitrou, giampaolo.rodola, Trundle, nvetoshkin, neologix
2011年03月07日 19:43:56socketpairsetmessageid: <1299527036.3.0.913790438649.issue11406@psf.upfronthosting.co.za>
2011年03月07日 19:43:54socketpairlinkissue11406 messages
2011年03月07日 19:43:54socketpaircreate

AltStyle によって変換されたページ (->オリジナル) /