[Python-checkins] CVS: python/dist/src/Modules xxsubtype.c,2.13,2.14

Fred L. Drake fdrake@users.sourceforge.net
Thu, 28 Mar 2002 07:49:56 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv30051/Modules

Modified Files:
	xxsubtype.c 
Log Message:
Add a simple test of the METH_CLASS and METH_STATIC flags for type methods.

Index: xxsubtype.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v
retrieving revision 2.13
retrieving revision 2.14
diff -C2 -d -r2.13 -r2.14
*** xxsubtype.c	12 Mar 2002 21:49:44 -0000	2.13
--- xxsubtype.c	28 Mar 2002 15:49:54 -0000	2.14
***************
*** 44,47 ****
--- 44,67 ----
  }
  
+ static PyObject *
+ spamlist_specialmeth(PyObject *self, PyObject *args, PyObject *kw)
+ {
+ 	PyObject *result = PyTuple_New(3);
+ 
+ 	if (result != NULL) {
+ 		if (self == NULL)
+ 			self = Py_None;
+ 		if (kw == NULL)
+ 			kw = Py_None;
+ 		Py_INCREF(self);
+ 		PyTuple_SET_ITEM(result, 0, self);
+ 		Py_INCREF(args);
+ 		PyTuple_SET_ITEM(result, 1, args);
+ 		Py_INCREF(kw);
+ 		PyTuple_SET_ITEM(result, 2, kw);
+ 	}
+ 	return result;
+ }
+ 
  static PyMethodDef spamlist_methods[] = {
  	{"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS,
***************
*** 49,52 ****
--- 69,80 ----
  	{"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS,
  	 	"setstate(state)"},
+ 	/* These entries differ only in the flags; they are used by the tests
+ 	   in test.test_descr. */
+ 	{"classmeth", (PyCFunction)spamlist_specialmeth,
+ 		METH_VARARGS | METH_KEYWORDS | METH_CLASS,
+ 	 	"classmeth(*args, **kw)"},
+ 	{"staticmeth", (PyCFunction)spamlist_specialmeth,
+ 		METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ 	 	"staticmeth(*args, **kw)"},
  	{NULL,	NULL},
  };