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 Alexander.Belopolsky
Recipients Alexander.Belopolsky, brian.curtin, loewis, marcin.bachry, nikratio, pitrou, theller
Date 2010-02-24.02:24:54
SpamBayes Score 3.655344e-07
Marked as misclassified No
Message-id <1266978296.19.0.88415967057.issue7736@psf.upfronthosting.co.za>
In-reply-to
Content
Another "+1" on the patch if it is needed.  Posix module consistently releases the GIL while making system calls and this is a good idea independent of this particular issue.

Looking at the patch made me wonder whether existing

                Py_BEGIN_ALLOW_THREADS
                ep = readdir(dirp);
                Py_END_ALLOW_THREADS

is safe.  Apparently it is safe as was explained in

http://mail.python.org/pipermail/python-dev/2006-April/063808.html

because "The pointer returned by readdir() points to data which may be overwritten by another call to readdir() on the same directory stream. This data is not overwritten by another call to readdir() on a different directory stream."

It may be appropriate to add a comment near the readdir() explaining why it is safe in this context.  Clearly I am not the only one who found this non-obvious.
History
Date User Action Args
2010-02-24 02:24:56Alexander.Belopolskysetrecipients: + Alexander.Belopolsky, loewis, theller, pitrou, marcin.bachry, brian.curtin, nikratio
2010-02-24 02:24:56Alexander.Belopolskysetmessageid: <1266978296.19.0.88415967057.issue7736@psf.upfronthosting.co.za>
2010-02-24 02:24:54Alexander.Belopolskylinkissue7736 messages
2010-02-24 02:24:54Alexander.Belopolskycreate