[Python-checkins] python/dist/src/Modules posixmodule.c,2.231,2.232

fdrake@sourceforge.net fdrake@sourceforge.net
Tue, 23 Apr 2002 08:58:05 -0700


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

Modified Files:
	posixmodule.c 
Log Message:
WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED:  New.

isatty(), WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(): Changed to return
    bools instead of ints.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.231
retrieving revision 2.232
diff -C2 -d -r2.231 -r2.232
*** posixmodule.c	20 Apr 2002 13:46:43 -0000	2.231
--- posixmodule.c	23 Apr 2002 15:58:01 -0000	2.232
***************
*** 4530,4535 ****
  
  static char posix_isatty__doc__[] =
! "isatty(fd) -> Boolean\n\
! Return true if the file descriptor 'fd' is an open file descriptor\n\
  connected to the slave end of a terminal.";
  
--- 4530,4535 ----
  
  static char posix_isatty__doc__[] =
! "isatty(fd) -> bool\n\
! Return True if the file descriptor 'fd' is an open file descriptor\n\
  connected to the slave end of a terminal.";
  
***************
*** 4540,4544 ****
  	if (!PyArg_ParseTuple(args, "i:isatty", &fd))
  		return NULL;
! 	return Py_BuildValue("i", isatty(fd));
  }
  
--- 4540,4544 ----
  	if (!PyArg_ParseTuple(args, "i:isatty", &fd))
  		return NULL;
! 	return PyBool_FromLong(isatty(fd));
  }
  
***************
*** 4824,4831 ****
  #ifdef HAVE_SYS_WAIT_H
  
  #ifdef WIFSTOPPED
  static char posix_WIFSTOPPED__doc__[] =
! "WIFSTOPPED(status) -> Boolean\n\
! Return true if the process returning 'status' was stopped.";
  
  static PyObject *
--- 4824,4886 ----
  #ifdef HAVE_SYS_WAIT_H
  
+ #ifdef WCOREDUMP
+ static char posix_WCOREDUMP__doc__[] =
+ "WCOREDUMP(status) -> bool\n\
+ Return True if the process returning 'status' was dumped to a core file.";
+ 
+ static PyObject *
+ posix_WCOREDUMP(PyObject *self, PyObject *args)
+ {
+ #ifdef UNION_WAIT
+ 	union wait status;
+ #define status_i (status.w_status)
+ #else
+ 	int status;
+ #define status_i status
+ #endif
+ 	status_i = 0;
+ 
+ 	if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &status_i))
+ 	{
+ 		return NULL;
+ 	}
+ 
+ 	return PyBool_FromLong(WCOREDUMP(status));
+ #undef status_i
+ }
+ #endif /* WCOREDUMP */
+ 
+ #ifdef WIFCONTINUED
+ static char posix_WIFCONTINUED__doc__[] =
+ "WIFCONTINUED(status) -> bool\n\
+ Return True if the process returning 'status' was continued from a\n\
+ job control stop.";
+ 
+ static PyObject *
+ posix_WCONTINUED(PyObject *self, PyObject *args)
+ {
+ #ifdef UNION_WAIT
+ 	union wait status;
+ #define status_i (status.w_status)
+ #else
+ 	int status;
+ #define status_i status
+ #endif
+ 	status_i = 0;
+ 
+ 	if (!PyArg_ParseTuple(args, "i:WCONTINUED", &status_i))
+ 	{
+ 		return NULL;
+ 	}
+ 
+ 	return PyBool_FromLong(WCONTINUED(status));
+ #undef status_i
+ }
+ #endif /* WIFCONTINUED */
+ 
  #ifdef WIFSTOPPED
  static char posix_WIFSTOPPED__doc__[] =
! "WIFSTOPPED(status) -> bool\n\
! Return True if the process returning 'status' was stopped.";
  
  static PyObject *
***************
*** 4846,4850 ****
  	}
  
! 	return Py_BuildValue("i", WIFSTOPPED(status));
  #undef status_i
  }
--- 4901,4905 ----
  	}
  
! 	return PyBool_FromLong(WIFSTOPPED(status));
  #undef status_i
  }
***************
*** 4853,4858 ****
  #ifdef WIFSIGNALED
  static char posix_WIFSIGNALED__doc__[] =
! "WIFSIGNALED(status) -> Boolean\n\
! Return true if the process returning 'status' was terminated by a signal.";
  
  static PyObject *
--- 4908,4913 ----
  #ifdef WIFSIGNALED
  static char posix_WIFSIGNALED__doc__[] =
! "WIFSIGNALED(status) -> bool\n\
! Return True if the process returning 'status' was terminated by a signal.";
  
  static PyObject *
***************
*** 4873,4877 ****
  	}
  
! 	return Py_BuildValue("i", WIFSIGNALED(status));
  #undef status_i
  }
--- 4928,4932 ----
  	}
  
! 	return PyBool_FromLong(WIFSIGNALED(status));
  #undef status_i
  }
***************
*** 4880,4884 ****
  #ifdef WIFEXITED
  static char posix_WIFEXITED__doc__[] =
! "WIFEXITED(status) -> Boolean\n\
  Return true if the process returning 'status' exited using the exit()\n\
  system call.";
--- 4935,4939 ----
  #ifdef WIFEXITED
  static char posix_WIFEXITED__doc__[] =
! "WIFEXITED(status) -> bool\n\
  Return true if the process returning 'status' exited using the exit()\n\
  system call.";
***************
*** 4901,4905 ****
  	}
  
! 	return Py_BuildValue("i", WIFEXITED(status));
  #undef status_i
  }
--- 4956,4960 ----
  	}
  
! 	return PyBool_FromLong(WIFEXITED(status));
  #undef status_i
  }
***************
*** 6408,6411 ****
--- 6463,6469 ----
  #endif
  #ifdef HAVE_SYS_WAIT_H
+ #ifdef WCOREDUMP
+         {"WCOREDUMP",	posix_WCOREDUMP, METH_VARARGS, posix_WCOREDUMP__doc__},
+ #endif /* WCOREDUMP */
  #ifdef WIFSTOPPED
          {"WIFSTOPPED",	posix_WIFSTOPPED, METH_VARARGS, posix_WIFSTOPPED__doc__},
***************
*** 6542,6547 ****
--- 6600,6611 ----
          if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1;
  #endif
+ #ifdef WCONTINUED
+         if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1;
+ #endif
  #ifdef WNOHANG
          if (ins(d, "WNOHANG", (long)WNOHANG)) return -1;
+ #endif
+ #ifdef WUNTRACED
+         if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1;
  #endif
  #ifdef O_RDONLY