[Python-checkins] CVS: python/dist/src/Modules spam.c,1.1.2.6,1.1.2.7
Guido van Rossum
gvanrossum@users.sourceforge.net
Fri, 29 Jun 2001 09:32:37 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv25234
Modified Files:
Tag: descr-branch
spam.c
Log Message:
Simplify and change the spam API: instead of exporting a separate type
object and constructor function for each type, the module now exports
just the type, by its natural name (spamlist or spamdict).
Index: spam.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/Attic/spam.c,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** spam.c 2001/06/06 14:27:54 1.1.2.6
--- spam.c 2001/06/29 16:32:35 1.1.2.7
***************
*** 68,72 ****
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
--- 68,72 ----
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
***************
*** 89,100 ****
};
! static PyObject *
! spamlist_new(void)
! {
! return PyObject_CallObject((PyObject *) &spamlist_type, NULL);
! }
- /* spamdict -- a dictf subtype */
-
typedef struct {
PyDictObject dict;
--- 89,94 ----
};
! /* spamdict -- a dict subtype */
typedef struct {
PyDictObject dict;
***************
*** 162,166 ****
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
--- 156,160 ----
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
***************
*** 183,213 ****
};
- static PyObject *
- spamdict_new(void)
- {
- return PyObject_CallObject((PyObject *) &spamdict_type, NULL);
- }
-
- static PyObject *
- spam_dict(PyObject *self, PyObject *args)
- {
- if (!PyArg_ParseTuple(args, ":dict"))
- return NULL;
- return spamdict_new();
- }
-
- /* Module spam */
-
- static PyObject *
- spam_list(PyObject *self, PyObject *args)
- {
- if (!PyArg_ParseTuple(args, ":list"))
- return NULL;
- return spamlist_new();
- }
-
static PyMethodDef spam_functions[] = {
- {"list", spam_list, METH_VARARGS, "create a new spamlist object"},
- {"dict", spam_dict, METH_VARARGS, "create a new spamdict object"},
{0}
};
--- 177,181 ----
***************
*** 229,237 ****
return;
Py_INCREF(&spamlist_type);
! if (PyDict_SetItemString(d, "SpamListType",
(PyObject *) &spamlist_type) < 0)
return;
Py_INCREF(&spamdict_type);
! if (PyDict_SetItemString(d, "SpamDictType",
(PyObject *) &spamdict_type) < 0)
return;
--- 197,205 ----
return;
Py_INCREF(&spamlist_type);
! if (PyDict_SetItemString(d, "spamlist",
(PyObject *) &spamlist_type) < 0)
return;
Py_INCREF(&spamdict_type);
! if (PyDict_SetItemString(d, "spamdict",
(PyObject *) &spamdict_type) < 0)
return;