comparison Python/sysmodule.c @ 12136:9b9abde032b3 legacy-trunk

Use modern PyArg_ParseTuple style, with function names. (Mostly.)
author Guido van Rossum <guido@python.org>
date Fri, 31 Mar 2000 00:38:29 +0000
parents dc65c5f6ad7c
children 60dd95c75999
comparison
equal deleted inserted replaced
12135:667878776933 12136:9b9abde032b3
104 sys_exc_info(self, args) 104 sys_exc_info(self, args)
105 PyObject *self; 105 PyObject *self;
106 PyObject *args; 106 PyObject *args;
107 { 107 {
108 PyThreadState *tstate; 108 PyThreadState *tstate;
109 if (!PyArg_Parse(args, "")) 109 if (!PyArg_ParseTuple(args, ":exc_info"))
110 return NULL; 110 return NULL;
111 tstate = PyThreadState_Get(); 111 tstate = PyThreadState_Get();
112 return Py_BuildValue( 112 return Py_BuildValue(
113 "(OOO)", 113 "(OOO)",
114 tstate->exc_type != NULL ? tstate->exc_type : Py_None, 114 tstate->exc_type != NULL ? tstate->exc_type : Py_None,
212 sys_mdebug(self, args) 212 sys_mdebug(self, args)
213 PyObject *self; 213 PyObject *self;
214 PyObject *args; 214 PyObject *args;
215 { 215 {
216 int flag; 216 int flag;
217 if (!PyArg_Parse(args, "i", &flag)) 217 if (!PyArg_ParseTuple(args, "i:mdebug", &flag))
218 return NULL; 218 return NULL;
219 mallopt(M_DEBUG, flag); 219 mallopt(M_DEBUG, flag);
220 Py_INCREF(Py_None); 220 Py_INCREF(Py_None);
221 return Py_None; 221 return Py_None;
222 } 222 }
226 sys_getrefcount(self, args) 226 sys_getrefcount(self, args)
227 PyObject *self; 227 PyObject *self;
228 PyObject *args; 228 PyObject *args;
229 { 229 {
230 PyObject *arg; 230 PyObject *arg;
231 if (!PyArg_Parse(args, "O", &arg)) 231 if (!PyArg_ParseTuple(args, "O:getrefcount", &arg))
232 return NULL; 232 return NULL;
233 return PyInt_FromLong((long) arg->ob_refcnt); 233 return PyInt_FromLong((long) arg->ob_refcnt);
234 } 234 }
235 235
236 static char getrefcount_doc[] = 236 static char getrefcount_doc[] =
244 sys_getcounts(self, args) 244 sys_getcounts(self, args)
245 PyObject *self, *args; 245 PyObject *self, *args;
246 { 246 {
247 extern PyObject *get_counts Py_PROTO((void)); 247 extern PyObject *get_counts Py_PROTO((void));
248 248
249 if (!PyArg_Parse(args, "")) 249 if (!PyArg_ParseTuple(args, ":getcounts"))
250 return NULL; 250 return NULL;
251 return get_counts(); 251 return get_counts();
252 } 252 }
253 #endif 253 #endif
254 254
262 extern PyObject *_Py_GetDXProfile Py_PROTO((PyObject *, PyObject *)); 262 extern PyObject *_Py_GetDXProfile Py_PROTO((PyObject *, PyObject *));
263 #endif 263 #endif
264 264
265 static PyMethodDef sys_methods[] = { 265 static PyMethodDef sys_methods[] = {
266 /* Might as well keep this in alphabetic order */ 266 /* Might as well keep this in alphabetic order */
267 {"exc_info", sys_exc_info, 0, exc_info_doc}, 267 {"exc_info", sys_exc_info, 1, exc_info_doc},
268 {"exit", sys_exit, 0, exit_doc}, 268 {"exit", sys_exit, 0, exit_doc},
269 #ifdef COUNT_ALLOCS 269 #ifdef COUNT_ALLOCS
270 {"getcounts", sys_getcounts, 0}, 270 {"getcounts", sys_getcounts, 1},
271 #endif 271 #endif
272 #ifdef DYNAMIC_EXECUTION_PROFILE 272 #ifdef DYNAMIC_EXECUTION_PROFILE
273 {"getdxp", _Py_GetDXProfile, 1}, 273 {"getdxp", _Py_GetDXProfile, 1},
274 #endif 274 #endif
275 #ifdef Py_TRACE_REFS 275 #ifdef Py_TRACE_REFS
276 {"getobjects", _Py_GetObjects, 1}, 276 {"getobjects", _Py_GetObjects, 1},
277 #endif 277 #endif
278 {"getrefcount", sys_getrefcount, 0, getrefcount_doc}, 278 {"getrefcount", sys_getrefcount, 1, getrefcount_doc},
279 #ifdef USE_MALLOPT 279 #ifdef USE_MALLOPT
280 {"mdebug", sys_mdebug, 0}, 280 {"mdebug", sys_mdebug, 1},
281 #endif 281 #endif
282 {"setcheckinterval", sys_setcheckinterval, 1, setcheckinterval_doc}, 282 {"setcheckinterval", sys_setcheckinterval, 1, setcheckinterval_doc},
283 {"setprofile", sys_setprofile, 0, setprofile_doc}, 283 {"setprofile", sys_setprofile, 0, setprofile_doc},
284 {"settrace", sys_settrace, 0, settrace_doc}, 284 {"settrace", sys_settrace, 0, settrace_doc},
285 {NULL, NULL} /* sentinel */ 285 {NULL, NULL} /* sentinel */