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 ocean-city
Recipients ocean-city
Date 2009-01-10.11:11:47
SpamBayes Score 0.0013158543
Marked as misclassified No
Message-id <1231585911.12.0.413619049778.issue4906@psf.upfronthosting.co.za>
In-reply-to
Content
Due to r68455, os.listdir fails on debug build (windows).

//////////////////////////////////

Python 2.7a0 (trunk, Jan 10 2009, 18:36:15) [MSC v.1200 32 bit (Intel)] 
on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import os
[33639 refs]
>>> os.listdir(".")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
WindowsError: [Error 0] この操作を正しく終了しました。: './*.*'
[33678 refs]

//////////////////////////////////

Probably a following XP Buildbot error comes from same reason.

http://www.python.org/dev/buildbot/trunk.stable/x86%20XP-4%
20trunk/builds/1759/step-compile/0

This error is raised near Modules/posixmodule.c (2205)

	Py_BEGIN_ALLOW_THREADS
	result = FindNextFile(hFindFile, &FileData);
	Py_END_ALLOW_THREADS
	/* FindNextFile sets error to ERROR_NO_MORE_FILES if
	   it got to the end of the directory. */
	if (!result && GetLastError() != ERROR_NO_MORE_FILES) {

GetLastError() is sometimes 0 when should be ERROR_NO_MORE_FILES.
This happens because, on debug build, Py_END_ALLOW_THREADS finally
reaches PyThread_get_key_value in Python/thread_nt.h, and TlsGetValue
in it calls SetValueError(0) when function succeeds. See
http://msdn.microsoft.com/en-us/library/ms686812.aspx

I've attached the patch to fix this. I believe LastError set by
TlsGetValue on its failure is not used anywhere.
History
Date User Action Args
2009-01-10 11:11:51ocean-citysetrecipients: + ocean-city
2009-01-10 11:11:51ocean-citysetmessageid: <1231585911.12.0.413619049778.issue4906@psf.upfronthosting.co.za>
2009-01-10 11:11:49ocean-citylinkissue4906 messages
2009-01-10 11:11:48ocean-citycreate