[Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.14,1.15 test_both.py,1.15,1.16

Neal Norwitz neal@metaslash.com
Mon, 2 Dec 2002 15:13:12 -0500


On Mon, Dec 02, 2002 at 02:47:04PM -0500, Tim Peters wrote:
> > > + 		PyObject *emptytuple = PyTuple_New(0);
> > > + 		if (emptytuple != NULL) {
> > > + 			result = Py_BuildValue("OOO",
> > > + 					       self->ob_type,
> > > + 					       emptytuple,
> > > + 					       state);
> > > + 			Py_DECREF(emptytuple);
> > > + 		}
> > > + 		Py_DECREF(state);
> 
> [Neal Norwitz]
> > What is the purpose of emptytuple here?
> 
> The docs for __reduce__ say the 2nd component of the return value must be a
> tuple or None, and the use of None is deprecated.  Hence an empty tuple.

Whoops, multitasking too much.  I didn't see emptytuple in Py_BuildValue().

> >  Could/should this code be:
> >
> >         result = Py_BuildValue(...);
> 
> I have no idea.  What does "..." mean?

I just meant the params were the same.  Of course, if I had
actually typed it in, I would have realized you were using it. :-)

Neal