[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.164,2.165

Mark Hammond python-dev@python.org
Mon, 14 Aug 2000 17:46:41 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv17883

Modified Files:
	posixmodule.c 
Log Message:
Fix for bug #110670 - Win32 os.listdir raises confusing errors:
The existing win32_error() function now returns the new(ish) WindowsError, ensuring we get correct error messages.

Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.164
retrieving revision 2.165
diff -C2 -r2.164 -r2.165
*** posixmodule.c	2000/08/14 04:47:33	2.164
--- posixmodule.c	2000/08/15 00:46:38	2.165
***************
*** 350,359 ****
  win32_error(char* function, char* filename)
  {
! 	/* XXX this could be improved */
  	errno = GetLastError();
  	if (filename)
! 		return PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
  	else
! 		return PyErr_SetFromErrno(PyExc_OSError);
  }
  #endif
--- 350,363 ----
  win32_error(char* function, char* filename)
  {
! 	/* XXX We should pass the function name along in the future.
! 	   (_winreg.c also wants to pass the function name.)
! 	   This would however require an additional param to the 
! 	   Windows error object, which is non-trivial.
! 	*/
  	errno = GetLastError();
  	if (filename)
! 		return PyErr_SetFromWindowsErrWithFilename(errno, filename);
  	else
! 		return PyErr_SetFromWindowsErr(errno);
  }
  #endif