[Python-checkins] CVS: python/dist/src/Demo/embed demo.c,1.6,1.7

Fred L. Drake fdrake@users.sourceforge.net
Fri, 16 Nov 2001 22:30:22 -0800


Update of /cvsroot/python/python/dist/src/Demo/embed
In directory usw-pr-cvs1:/tmp/cvs-serv26599

Modified Files:
	demo.c 
Log Message:
Update to use more modern calling conventions; also avoid a magic number
in the function table.  Add a docstring for the function as well, since
examples should show good form.


Index: demo.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/embed/demo.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** demo.c	2001/01/10 17:09:00	1.6
--- demo.c	2001/11/17 06:30:20	1.7
***************
*** 49,59 ****
  xyzzy_foo(PyObject *self, PyObject* args)
  {
- 	if (!PyArg_ParseTuple(args, ""))
- 		return NULL;
  	return PyInt_FromLong(42L);
  }
  
  static PyMethodDef xyzzy_methods[] = {
! 	{"foo",		xyzzy_foo,	1},
  	{NULL,		NULL}		/* sentinel */
  };
--- 49,58 ----
  xyzzy_foo(PyObject *self, PyObject* args)
  {
  	return PyInt_FromLong(42L);
  }
  
  static PyMethodDef xyzzy_methods[] = {
! 	{"foo",		xyzzy_foo,	METH_NOARGS,
! 	 "Return the meaning of everything."},
  	{NULL,		NULL}		/* sentinel */
  };