Mailing List Archive

CVS: python/dist/src/Modules _testcapimodule.c,1.15,1.16
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv29675

Modified Files:
_testcapimodule.c
Log Message:
Switch to using METH_NOARGS where possible.
Convert to use PyModule_*() instead of manipulating the module dict directly.


Index: _testcapimodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_testcapimodule.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** _testcapimodule.c 9 Jan 2002 16:21:27 -0000 1.15
--- _testcapimodule.c 1 Apr 2002 14:28:58 -0000 1.16
***************
*** 45,53 ****

static PyObject*
! test_config(PyObject *self, PyObject *args)
{
- if (!PyArg_ParseTuple(args, ":test_config"))
- return NULL;
-
#define CHECK_SIZEOF(FATNAME, TYPE) \
if (FATNAME != sizeof(TYPE)) \
--- 45,50 ----

static PyObject*
! test_config(PyObject *self)
{
#define CHECK_SIZEOF(FATNAME, TYPE) \
if (FATNAME != sizeof(TYPE)) \
***************
*** 70,79 ****

static PyObject*
! test_list_api(PyObject *self, PyObject *args)
{
PyObject* list;
int i;
- if (!PyArg_ParseTuple(args, ":test_list_api"))
- return NULL;

/* SF bug 132008: PyList_Reverse segfaults */
--- 67,74 ----

static PyObject*
! test_list_api(PyObject *self)
{
PyObject* list;
int i;

/* SF bug 132008: PyList_Reverse segfaults */
***************
*** 158,168 ****

static PyObject*
! test_dict_iteration(PyObject* self, PyObject* args)
{
int i;

- if (!PyArg_ParseTuple(args, ":test_dict_iteration"))
- return NULL;
-
for (i = 0; i < 200; i++) {
if (test_dict_inner(i) < 0) {
--- 153,160 ----

static PyObject*
! test_dict_iteration(PyObject* self)
{
int i;

for (i = 0; i < 200; i++) {
if (test_dict_inner(i) < 0) {
***************
*** 209,217 ****

static PyObject *
! test_long_api(PyObject* self, PyObject* args)
{
- if (!PyArg_ParseTuple(args, ":test_long_api"))
- return NULL;
-
return TESTNAME(raise_test_long_error);
}
--- 201,206 ----

static PyObject *
! test_long_api(PyObject* self)
{
return TESTNAME(raise_test_long_error);
}
***************
*** 242,250 ****

static PyObject *
! test_longlong_api(PyObject* self, PyObject* args)
{
- if (!PyArg_ParseTuple(args, ":test_longlong_api"))
- return NULL;
-
return TESTNAME(raise_test_longlong_error);
}
--- 231,236 ----

static PyObject *
! test_longlong_api(PyObject* self)
{
return TESTNAME(raise_test_longlong_error);
}
***************
*** 262,273 ****
*/
static PyObject *
! test_L_code(PyObject *self, PyObject *args)
{
PyObject *tuple, *num;
LONG_LONG value;

- if (!PyArg_ParseTuple(args, ":test_L_code"))
- return NULL;
-
tuple = PyTuple_New(1);
if (tuple == NULL)
--- 248,256 ----
*/
static PyObject *
! test_L_code(PyObject *self)
{
PyObject *tuple, *num;
LONG_LONG value;

tuple = PyTuple_New(1);
if (tuple == NULL)
***************
*** 314,318 ****
*/
static PyObject *
! test_u_code(PyObject *self, PyObject *args)
{
PyObject *tuple, *obj;
--- 297,301 ----
*/
static PyObject *
! test_u_code(PyObject *self)
{
PyObject *tuple, *obj;
***************
*** 320,326 ****
int len;

- if (!PyArg_ParseTuple(args, ":test_u_code"))
- return NULL;
-
tuple = PyTuple_New(1);
if (tuple == NULL)
--- 303,306 ----
***************
*** 382,396 ****

static PyMethodDef TestMethods[] = {
! {"raise_exception", raise_exception, METH_VARARGS},
! {"test_config", test_config, METH_VARARGS},
! {"test_list_api", test_list_api, METH_VARARGS},
! {"test_dict_iteration", test_dict_iteration, METH_VARARGS},
! {"test_long_api", test_long_api, METH_VARARGS},
#ifdef HAVE_LONG_LONG
! {"test_longlong_api", test_longlong_api, METH_VARARGS},
! {"test_L_code", test_L_code, METH_VARARGS},
#endif
#ifdef Py_USING_UNICODE
! {"test_u_code", test_u_code, METH_VARARGS},
#endif
{NULL, NULL} /* sentinel */
--- 362,376 ----

static PyMethodDef TestMethods[] = {
! {"raise_exception", raise_exception, METH_VARARGS},
! {"test_config", (PyCFunction)test_config, METH_NOARGS},
! {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS},
! {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS},
! {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS},
#ifdef HAVE_LONG_LONG
! {"test_longlong_api", (PyCFunction)test_longlong_api, METH_NOARGS},
! {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS},
#endif
#ifdef Py_USING_UNICODE
! {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS},
#endif
{NULL, NULL} /* sentinel */
***************
*** 400,409 ****
init_testcapi(void)
{
! PyObject *m, *d;

m = Py_InitModule("_testcapi", TestMethods);

TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
! d = PyModule_GetDict(m);
! PyDict_SetItemString(d, "error", TestError);
}
--- 380,389 ----
init_testcapi(void)
{
! PyObject *m;

m = Py_InitModule("_testcapi", TestMethods);

TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
! Py_INCREF(TestError);
! PyModule_AddObject(m, "error", TestError);
}