File: | Modules/_multiprocessing/multiprocessing.c |
Location: | line 159, column 5 |
Description: | Assigned value is always the same as the existing value |
1 | /* | ||
2 | * Extension module used by multiprocessing package | ||
3 | * | ||
4 | * multiprocessing.c | ||
5 | * | ||
6 | * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt | ||
7 | */ | ||
8 | |||
9 | #include "multiprocessing.h" | ||
10 | |||
11 | #ifdef SCM_RIGHTS0x01 | ||
12 | #define HAVE_FD_TRANSFER1 1 | ||
13 | #else | ||
14 | #define HAVE_FD_TRANSFER1 0 | ||
15 | #endif | ||
16 | |||
17 | PyObject *create_win32_namespace(void); | ||
18 | |||
19 | PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; | ||
20 | PyObject *ProcessError, *BufferTooShort; | ||
21 | |||
22 | /* | ||
23 | * Function which raises exceptions based on error codes | ||
24 | */ | ||
25 | |||
26 | PyObject * | ||
27 | mp_SetError(PyObject *Type, int num) | ||
28 | { | ||
29 | switch (num) { | ||
30 | #ifdef MS_WINDOWS | ||
31 | case MP_STANDARD_ERROR(-1): | ||
32 | if (Type == NULL((void*)0)) | ||
33 | Type = PyExc_WindowsError; | ||
34 | PyErr_SetExcFromWindowsErr(Type, 0); | ||
35 | break; | ||
36 | case MP_SOCKET_ERROR(-1005): | ||
37 | if (Type == NULL((void*)0)) | ||
38 | Type = PyExc_WindowsError; | ||
39 | PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); | ||
40 | break; | ||
41 | #else /* !MS_WINDOWS */ | ||
42 | case MP_STANDARD_ERROR(-1): | ||
43 | case MP_SOCKET_ERROR(-1005): | ||
44 | if (Type == NULL((void*)0)) | ||
45 | Type = PyExc_OSError; | ||
46 | PyErr_SetFromErrno(Type); | ||
47 | break; | ||
48 | #endif /* !MS_WINDOWS */ | ||
49 | case MP_MEMORY_ERROR(-1001): | ||
50 | PyErr_NoMemory(); | ||
51 | break; | ||
52 | case MP_END_OF_FILE(-1002): | ||
53 | PyErr_SetNone(PyExc_EOFError); | ||
54 | break; | ||
55 | case MP_EARLY_END_OF_FILE(-1003): | ||
56 | PyErr_SetString(PyExc_IOError, | ||
57 | "got end of file during message"); | ||
58 | break; | ||
59 | case MP_BAD_MESSAGE_LENGTH(-1004): | ||
60 | PyErr_SetString(PyExc_IOError, "bad message length"); | ||
61 | break; | ||
62 | case MP_EXCEPTION_HAS_BEEN_SET(-1006): | ||
63 | break; | ||
64 | default: | ||
65 | PyErr_Format(PyExc_RuntimeError, | ||
66 | "unkown error number %d", num); | ||
67 | } | ||
68 | return NULL((void*)0); | ||
69 | } | ||
70 | |||
71 | |||
72 | /* | ||
73 | * Windows only | ||
74 | */ | ||
75 | |||
76 | #ifdef MS_WINDOWS | ||
77 | |||
78 | /* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ | ||
79 | |||
80 | HANDLEint sigint_event = NULL((void*)0); | ||
81 | |||
82 | static BOOLint WINAPI | ||
83 | ProcessingCtrlHandler(DWORD dwCtrlType) | ||
84 | { | ||
85 | SetEvent(sigint_event); | ||
86 | return FALSE0; | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Unix only | ||
91 | */ | ||
92 | |||
93 | #else /* !MS_WINDOWS */ | ||
94 | |||
95 | #if HAVE_FD_TRANSFER1 | ||
96 | |||
97 | /* Functions for transferring file descriptors between processes. | ||
98 | Reimplements some of the functionality of the fdcred | ||
99 | module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ | ||
100 | |||
101 | static PyObject * | ||
102 | multiprocessing_sendfd(PyObject *self, PyObject *args) | ||
103 | { | ||
104 | int conn, fd, res; | ||
105 | char dummy_char; | ||
106 | char buf[CMSG_SPACE(sizeof(int))(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr )) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1 )) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) ) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1) ))]; | ||
107 | struct msghdr msg = {0}; | ||
108 | struct iovec dummy_iov; | ||
109 | struct cmsghdr *cmsg; | ||
110 | |||
111 | if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "ii", &conn, &fd)) | ||
112 | return NULL((void*)0); | ||
113 | |||
114 | dummy_iov.iov_base = &dummy_char; | ||
115 | dummy_iov.iov_len = 1; | ||
116 | msg.msg_control = buf; | ||
117 | msg.msg_controllen = sizeof(buf); | ||
118 | msg.msg_iov = &dummy_iov; | ||
119 | msg.msg_iovlen = 1; | ||
120 | cmsg = CMSG_FIRSTHDR(&msg)((&msg)->msg_controllen >= sizeof(struct cmsghdr) ? (struct cmsghdr *)(&msg)->msg_control : (struct cmsghdr *)0L); | ||
121 | cmsg->cmsg_level = SOL_SOCKET0xffff; | ||
122 | cmsg->cmsg_type = SCM_RIGHTS0x01; | ||
123 | cmsg->cmsg_len = CMSG_LEN(sizeof(int))(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr )) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1 )) + (sizeof(int))); | ||
124 | msg.msg_controllen = cmsg->cmsg_len; | ||
125 | *CMSG_DATA(cmsg)((unsigned char *)(cmsg) + ((__darwin_size_t)((char *)(__darwin_size_t )(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ ( sizeof(__uint32_t) - 1))) = fd; | ||
126 | |||
127 | Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread(); | ||
128 | res = sendmsg(conn, &msg, 0); | ||
129 | Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); } | ||
130 | |||
131 | if (res < 0) | ||
132 | return PyErr_SetFromErrno(PyExc_OSError); | ||
133 | Py_RETURN_NONEreturn ( _Py_RefTotal++ , ((PyObject*)((&_Py_NoneStruct)) )->ob_refcnt++), (&_Py_NoneStruct); | ||
134 | } | ||
135 | |||
136 | static PyObject * | ||
137 | multiprocessing_recvfd(PyObject *self, PyObject *args) | ||
138 | { | ||
139 | int conn, fd, res; | ||
140 | char dummy_char; | ||
141 | char buf[CMSG_SPACE(sizeof(int))(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr )) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1 )) + ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) ) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1) ))]; | ||
142 | struct msghdr msg = {0}; | ||
143 | struct iovec dummy_iov; | ||
144 | struct cmsghdr *cmsg; | ||
145 | |||
146 | if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "i", &conn)) | ||
| |||
147 | return NULL((void*)0); | ||
148 | |||
149 | dummy_iov.iov_base = &dummy_char; | ||
150 | dummy_iov.iov_len = 1; | ||
151 | msg.msg_control = buf; | ||
152 | msg.msg_controllen = sizeof(buf); | ||
153 | msg.msg_iov = &dummy_iov; | ||
154 | msg.msg_iovlen = 1; | ||
155 | cmsg = CMSG_FIRSTHDR(&msg)((&msg)->msg_controllen >= sizeof(struct cmsghdr) ? (struct cmsghdr *)(&msg)->msg_control : (struct cmsghdr *)0L); | ||
156 | cmsg->cmsg_level = SOL_SOCKET0xffff; | ||
157 | cmsg->cmsg_type = SCM_RIGHTS0x01; | ||
158 | cmsg->cmsg_len = CMSG_LEN(sizeof(int))(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct cmsghdr )) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1 )) + (sizeof(int))); | ||
159 | msg.msg_controllen = cmsg->cmsg_len; | ||
| |||
160 | |||
161 | Py_BEGIN_ALLOW_THREADS{ PyThreadState *_save; _save = PyEval_SaveThread(); | ||
162 | res = recvmsg(conn, &msg, 0); | ||
163 | Py_END_ALLOW_THREADSPyEval_RestoreThread(_save); } | ||
164 | |||
165 | if (res < 0) | ||
166 | return PyErr_SetFromErrno(PyExc_OSError); | ||
167 | |||
168 | fd = *CMSG_DATA(cmsg)((unsigned char *)(cmsg) + ((__darwin_size_t)((char *)(__darwin_size_t )(sizeof(struct cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ ( sizeof(__uint32_t) - 1))); | ||
169 | return Py_BuildValue_Py_BuildValue_SizeT("i", fd); | ||
170 | } | ||
171 | |||
172 | #endif /* HAVE_FD_TRANSFER */ | ||
173 | |||
174 | #endif /* !MS_WINDOWS */ | ||
175 | |||
176 | |||
177 | /* | ||
178 | * All platforms | ||
179 | */ | ||
180 | |||
181 | static PyObject* | ||
182 | multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) | ||
183 | { | ||
184 | void *buffer; | ||
185 | Py_ssize_t buffer_len; | ||
186 | |||
187 | if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) | ||
188 | return NULL((void*)0); | ||
189 | |||
190 | return Py_BuildValue_Py_BuildValue_SizeT("N" F_PY_SSIZE_T"n", | ||
191 | PyLong_FromVoidPtr(buffer), buffer_len); | ||
192 | } | ||
193 | |||
194 | |||
195 | /* | ||
196 | * Function table | ||
197 | */ | ||
198 | |||
199 | static PyMethodDef module_methods[] = { | ||
200 | {"address_of_buffer", multiprocessing_address_of_buffer, METH_O0x0008, | ||
201 | "address_of_buffer(obj) -> int\n" | ||
202 | "Return address of obj assuming obj supports buffer inteface"}, | ||
203 | #if HAVE_FD_TRANSFER1 | ||
204 | {"sendfd", multiprocessing_sendfd, METH_VARARGS0x0001, | ||
205 | "sendfd(sockfd, fd) -> None\n" | ||
206 | "Send file descriptor given by fd over the unix domain socket\n" | ||
207 | "whose file decriptor is sockfd"}, | ||
208 | {"recvfd", multiprocessing_recvfd, METH_VARARGS0x0001, | ||
209 | "recvfd(sockfd) -> fd\n" | ||
210 | "Receive a file descriptor over a unix domain socket\n" | ||
211 | "whose file decriptor is sockfd"}, | ||
212 | #endif | ||
213 | {NULL((void*)0)} | ||
214 | }; | ||
215 | |||
216 | |||
217 | /* | ||
218 | * Initialize | ||
219 | */ | ||
220 | |||
221 | static struct PyModuleDef multiprocessing_module = { | ||
222 | PyModuleDef_HEAD_INIT{ { 0, 0, 1, ((void*)0) }, ((void*)0), 0, ((void*)0), }, | ||
223 | "_multiprocessing", | ||
224 | NULL((void*)0), | ||
225 | -1, | ||
226 | module_methods, | ||
227 | NULL((void*)0), | ||
228 | NULL((void*)0), | ||
229 | NULL((void*)0), | ||
230 | NULL((void*)0) | ||
231 | }; | ||
232 | |||
233 | |||
234 | PyMODINIT_FUNCPyObject* | ||
235 | PyInit__multiprocessing(void) | ||
236 | { | ||
237 | PyObject *module, *temp, *value; | ||
238 | |||
239 | /* Initialize module */ | ||
240 | module = PyModule_Create(&multiprocessing_module)PyModule_Create2TraceRefs(&multiprocessing_module, 1013); | ||
241 | if (!module) | ||
242 | return NULL((void*)0); | ||
243 | |||
244 | /* Get copy of objects from pickle */ | ||
245 | temp = PyImport_ImportModule(PICKLE_MODULE"pickle"); | ||
246 | if (!temp) | ||
247 | return NULL((void*)0); | ||
248 | pickle_dumps = PyObject_GetAttrString(temp, "dumps"); | ||
249 | pickle_loads = PyObject_GetAttrString(temp, "loads"); | ||
250 | pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); | ||
251 | Py_XDECREF(temp)do { if ((temp) == ((void*)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 251, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); } while (0); | ||
252 | |||
253 | /* Get copy of BufferTooShort */ | ||
254 | temp = PyImport_ImportModule("multiprocessing"); | ||
255 | if (!temp) | ||
256 | return NULL((void*)0); | ||
257 | BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); | ||
258 | Py_XDECREF(temp)do { if ((temp) == ((void*)0)) ; else do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 258, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); } while (0); | ||
259 | |||
260 | /* Add connection type to module */ | ||
261 | if (PyType_Ready(&ConnectionType) < 0) | ||
262 | return NULL((void*)0); | ||
263 | Py_INCREF(&ConnectionType)( _Py_RefTotal++ , ((PyObject*)(&ConnectionType))->ob_refcnt ++); | ||
264 | PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); | ||
265 | |||
266 | #if defined(MS_WINDOWS) || \ | ||
267 | (defined(HAVE_SEM_OPEN1) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)) | ||
268 | /* Add SemLock type to module */ | ||
269 | if (PyType_Ready(&SemLockType) < 0) | ||
270 | return NULL((void*)0); | ||
271 | Py_INCREF(&SemLockType)( _Py_RefTotal++ , ((PyObject*)(&SemLockType))->ob_refcnt ++); | ||
272 | { | ||
273 | PyObject *py_sem_value_max; | ||
274 | /* Some systems define SEM_VALUE_MAX as an unsigned value that | ||
275 | * causes it to be negative when used as an int (NetBSD). */ | ||
276 | if ((int)(SEM_VALUE_MAX32767) < 0) | ||
277 | py_sem_value_max = PyLong_FromLong(INT_MAX2147483647); | ||
278 | else | ||
279 | py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX32767); | ||
280 | if (py_sem_value_max == NULL((void*)0)) | ||
281 | return NULL((void*)0); | ||
282 | PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", | ||
283 | py_sem_value_max); | ||
284 | } | ||
285 | PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); | ||
286 | #endif | ||
287 | |||
288 | #ifdef MS_WINDOWS | ||
289 | /* Add PipeConnection to module */ | ||
290 | if (PyType_Ready(&PipeConnectionType) < 0) | ||
291 | return NULL((void*)0); | ||
292 | Py_INCREF(&PipeConnectionType)( _Py_RefTotal++ , ((PyObject*)(&PipeConnectionType))-> ob_refcnt++); | ||
293 | PyModule_AddObject(module, "PipeConnection", | ||
294 | (PyObject*)&PipeConnectionType); | ||
295 | |||
296 | /* Initialize win32 class and add to multiprocessing */ | ||
297 | temp = create_win32_namespace(); | ||
298 | if (!temp) | ||
299 | return NULL((void*)0); | ||
300 | PyModule_AddObject(module, "win32", temp); | ||
301 | |||
302 | /* Initialize the event handle used to signal Ctrl-C */ | ||
303 | sigint_event = CreateEvent(NULL((void*)0), TRUE1, FALSE0, NULL((void*)0)); | ||
304 | if (!sigint_event) { | ||
305 | PyErr_SetFromWindowsErr(0); | ||
306 | return NULL((void*)0); | ||
307 | } | ||
308 | if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE1)) { | ||
309 | PyErr_SetFromWindowsErr(0); | ||
310 | return NULL((void*)0); | ||
311 | } | ||
312 | #endif | ||
313 | |||
314 | /* Add configuration macros */ | ||
315 | temp = PyDict_New(); | ||
316 | if (!temp) | ||
317 | return NULL((void*)0); | ||
318 | |||
319 | #define ADD_FLAG(name)value = _Py_BuildValue_SizeT("i", name); if (value == ((void* )0)) { do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 319, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "name", value) < 0) { do { if (_Py_RefTotal-- , --( (PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp )->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 319, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 319, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 319, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0) \ | ||
320 | value = Py_BuildValue_Py_BuildValue_SizeT("i", name); \ | ||
321 | if (value == NULL((void*)0)) { Py_DECREF(temp)do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 321, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return NULL((void*)0); } \ | ||
322 | if (PyDict_SetItemString(temp, #name, value) < 0) { \ | ||
323 | Py_DECREF(temp)do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 323, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); Py_DECREF(value)do { if (_Py_RefTotal-- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 323, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return NULL((void*)0); } \ | ||
324 | Py_DECREF(value)do { if (_Py_RefTotal-- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 324, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0) | ||
325 | |||
326 | #if defined(HAVE_SEM_OPEN1) && !defined(POSIX_SEMAPHORES_NOT_ENABLED) | ||
327 | ADD_FLAG(HAVE_SEM_OPEN)value = _Py_BuildValue_SizeT("i", 1); if (value == ((void*)0) ) { do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 327, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "HAVE_SEM_OPEN", value) < 0) { do { if (_Py_RefTotal -- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 327, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 327, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 327, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); | ||
328 | #endif | ||
329 | #ifdef HAVE_SEM_TIMEDWAIT | ||
330 | ADD_FLAG(HAVE_SEM_TIMEDWAIT)value = _Py_BuildValue_SizeT("i", HAVE_SEM_TIMEDWAIT); if (value == ((void*)0)) { do { if (_Py_RefTotal-- , --((PyObject*)(temp ))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 330, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "HAVE_SEM_TIMEDWAIT", value) < 0) { do { if (_Py_RefTotal -- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 330, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 330, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 330, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); | ||
331 | #endif | ||
332 | #ifdef HAVE_FD_TRANSFER1 | ||
333 | ADD_FLAG(HAVE_FD_TRANSFER)value = _Py_BuildValue_SizeT("i", 1); if (value == ((void*)0) ) { do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 333, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "HAVE_FD_TRANSFER", value) < 0) { do { if (_Py_RefTotal -- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 333, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 333, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 333, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); | ||
334 | #endif | ||
335 | #ifdef HAVE_BROKEN_SEM_GETVALUE1 | ||
336 | ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE)value = _Py_BuildValue_SizeT("i", 1); if (value == ((void*)0) ) { do { if (_Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 336, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "HAVE_BROKEN_SEM_GETVALUE", value) < 0) { do { if ( _Py_RefTotal-- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount ("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 336, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 336, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 336, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); | ||
337 | #endif | ||
338 | #ifdef HAVE_BROKEN_SEM_UNLINK | ||
339 | ADD_FLAG(HAVE_BROKEN_SEM_UNLINK)value = _Py_BuildValue_SizeT("i", HAVE_BROKEN_SEM_UNLINK); if (value == ((void*)0)) { do { if (_Py_RefTotal-- , --((PyObject *)(temp))->ob_refcnt != 0) { if (((PyObject*)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 339, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); return ((void*)0); } if (PyDict_SetItemString (temp, "HAVE_BROKEN_SEM_UNLINK", value) < 0) { do { if (_Py_RefTotal -- , --((PyObject*)(temp))->ob_refcnt != 0) { if (((PyObject *)temp)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 339, (PyObject *)(temp)); } else _Py_Dealloc((PyObject *)(temp )); } while (0); do { if (_Py_RefTotal-- , --((PyObject*)(value ))->ob_refcnt != 0) { if (((PyObject*)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 339, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); return ((void*)0); } do { if (_Py_RefTotal -- , --((PyObject*)(value))->ob_refcnt != 0) { if (((PyObject *)value)->ob_refcnt < 0) _Py_NegativeRefcount("/Users/brett/Dev/python/3.x/py3k/Modules/_multiprocessing/multiprocessing.c" , 339, (PyObject *)(value)); } else _Py_Dealloc((PyObject *)( value)); } while (0); | ||
340 | #endif | ||
341 | |||
342 | if (PyModule_AddObject(module, "flags", temp) < 0) | ||
343 | return NULL((void*)0); | ||
344 | |||
345 | return module; | ||
346 | } |