[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.248,2.249 errors.c,2.67,2.68

Martin v. L?wis loewis@users.sourceforge.net
Sat, 09 Mar 2002 04:07:53 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv5110

Modified Files:
	bltinmodule.c errors.c 
Log Message:
Patch #494045: patches errno and stat to cope on plan9.


Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.248
retrieving revision 2.249
diff -C2 -d -r2.248 -r2.249
*** bltinmodule.c	9 Mar 2002 00:06:26 -0000	2.248
--- bltinmodule.c	9 Mar 2002 12:07:51 -0000	2.249
***************
*** 537,543 ****
  	PyCompilerFlags cf;
  	int exists;
- #ifndef RISCOS
- 	struct stat s;
- #endif
  
  	if (!PyArg_ParseTuple(args, "s|O!O!:execfile",
--- 537,540 ----
***************
*** 561,576 ****
  	exists = 0;
  	/* Test for existence or directory. */
! #ifndef RISCOS
! 	if (!stat(filename, &s)) {
! 		if (S_ISDIR(s.st_mode))
! #if defined(PYOS_OS2) && defined(PYCC_VACPP)
! 			errno = EOS2ERR;
! #else
! 			errno = EISDIR;
! #endif
! 		else
! 			exists = 1;
  	}
! #else
  	if (object_exists(filename)) {
  		if (isdir(filename))
--- 558,574 ----
  	exists = 0;
  	/* Test for existence or directory. */
! #if defined(PLAN9)
! 	{
! 		Dir *d;
! 
! 		if ((d = dirstat(filename))!=nil) {
! 			if(d->mode & DMDIR)
! 				werrstr("is a directory");
! 			else
! 				exists = 1;
! 			free(d);
! 		}
  	}
! #elif defined(RISCOS)
  	if (object_exists(filename)) {
  		if (isdir(filename))
***************
*** 579,583 ****
  			exists = 1;
  	}
! #endif /* RISCOS */
  
          if (exists) {
--- 577,595 ----
  			exists = 1;
  	}
! #else	/* standard Posix */
! 	{
! 		struct stat s;
! 		if (stat(filename, &s) == 0) {
! 			if (S_ISDIR(s.st_mode))
! #				if defined(PY_OS2) && defined(PYCC_VACPP)
! 					errno = EOS2ERR;
! #				else
! 					errno = EISDIR;
! #				endif
! 			else
! 				exists = 1;
! 		}
! 	}
! #endif
  
          if (exists) {

Index: errors.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v
retrieving revision 2.67
retrieving revision 2.68
diff -C2 -d -r2.67 -r2.68
*** errors.c	3 Mar 2002 21:30:27 -0000	2.67
--- errors.c	9 Mar 2002 12:07:51 -0000	2.68
***************
*** 265,268 ****
--- 265,271 ----
  	char *s;
  	int i = errno;
+ #ifdef PLAN9
+ 	char errbuf[ERRMAX];
+ #endif
  #ifdef MS_WIN32
  	char *s_buf = NULL;
***************
*** 272,275 ****
--- 275,282 ----
  		return NULL;
  #endif
+ #ifdef PLAN9
+ 	rerrstr(errbuf, sizeof errbuf);
+ 	s = errbuf;
+ #else
  	if (i == 0)
  		s = "Error"; /* Sometimes errno didn't get set */
***************
*** 306,310 ****
  		}
  	}
! #endif
  	if (filename != NULL)
  		v = Py_BuildValue("(iss)", i, s, filename);
--- 313,318 ----
  		}
  	}
! #endif /* Unix/Windows */
! #endif /* PLAN 9*/
  	if (filename != NULL)
  		v = Py_BuildValue("(iss)", i, s, filename);