comparison Python/pythonrun.c @ 59605:768722b2ae0a

* Replaces the internals of the subprocess module from fork through exec on POSIX systems with a C extension module. This is required in order for the subprocess module to be made thread safe. The pure python implementation is retained so that it can continue to be used if for some reason the _posixsubprocess extension module is not available. The unittest executes tests on both code paths to guarantee compatibility. * Moves PyLong_FromPid and PyLong_AsPid from posixmodule.c into longobject.h. Code reviewed by jeffrey.yasskin at http://codereview.appspot.com/223077/show
author Gregory P. Smith <greg@mad-scientist.com>
date Sun, 14 Mar 2010 06:49:55 +0000
parents 42261c6ca564
children 7b69e630d237
comparison
equal deleted inserted replaced
59604:f097f2ba2329 59605:768722b2ae0a
2128 #endif 2128 #endif
2129 PyOS_InitInterrupts(); /* May imply initsignal() */ 2129 PyOS_InitInterrupts(); /* May imply initsignal() */
2130 } 2130 }
2131 2131
2132 2132
2133 /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
2134 *
2135 * All of the code in this function must only use async-signal-safe functions,
2136 * listed at `man 7 signal` or
2137 * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
2138 */
2139 void
2140 _Py_RestoreSignals(void)
2141 {
2142 #ifdef SIGPIPE
2143 PyOS_setsig(SIGPIPE, SIG_DFL);
2144 #endif
2145 #ifdef SIGXFZ
2146 PyOS_setsig(SIGXFZ, SIG_DFL);
2147 #endif
2148 #ifdef SIGXFSZ
2149 PyOS_setsig(SIGXFSZ, SIG_DFL);
2150 #endif
2151 }
2152
2153
2133 /* 2154 /*
2134 * The file descriptor fd is considered ``interactive'' if either 2155 * The file descriptor fd is considered ``interactive'' if either
2135 * a) isatty(fd) is TRUE, or 2156 * a) isatty(fd) is TRUE, or
2136 * b) the -i flag was given, and the filename associated with 2157 * b) the -i flag was given, and the filename associated with
2137 * the descriptor is NULL or "<stdin>" or "???". 2158 * the descriptor is NULL or "<stdin>" or "???".
2221 signal(sig, handler); 2242 signal(sig, handler);
2222 return handler; 2243 return handler;
2223 #endif 2244 #endif
2224 } 2245 }
2225 2246
2247 /*
2248 * All of the code in this function must only use async-signal-safe functions,
2249 * listed at `man 7 signal` or
2250 * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
2251 */
2226 PyOS_sighandler_t 2252 PyOS_sighandler_t
2227 PyOS_setsig(int sig, PyOS_sighandler_t handler) 2253 PyOS_setsig(int sig, PyOS_sighandler_t handler)
2228 { 2254 {
2229 #ifdef HAVE_SIGACTION 2255 #ifdef HAVE_SIGACTION
2230 struct sigaction context, ocontext; 2256 struct sigaction context, ocontext;