[Python-checkins] python/nondist/sandbox/datetime obj_timetz.c,1.6,1.7
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
2002年12月11日 13:34:50 -0800
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv3630
Modified Files:
obj_timetz.c
Log Message:
timetz_repr(): Simplified some of this excruciating code.
PyString_ConcatAndDel is happy to accept NULL arguments, so there's
really no need for error-checking after every teensy step here.
Index: obj_timetz.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_timetz.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** obj_timetz.c 11 Dec 2002 21:29:56 -0000 1.6
--- obj_timetz.c 11 Dec 2002 21:34:48 -0000 1.7
***************
*** 75,100 ****
/* Append ", tzinfo=". */
! r = PyString_FromString(", tzinfo=");
! if (r == NULL) {
! Py_DECREF(result);
! return NULL;
! }
! PyString_ConcatAndDel(&result, r);
/* Append repr(tzinfo). */
! r = PyObject_Repr(self->tzinfo);
! if (r == NULL) {
! Py_DECREF(result);
! return NULL;
! }
! PyString_ConcatAndDel(&result, r);
/* Add a closing paren. */
! r = PyString_FromString(")");
! if (r == NULL) {
! Py_DECREF(result);
! return NULL;
! }
! PyString_ConcatAndDel(&result, r);
return result;
}
--- 75,85 ----
/* Append ", tzinfo=". */
! PyString_ConcatAndDel(&result, PyString_FromString(", tzinfo="));
/* Append repr(tzinfo). */
! PyString_ConcatAndDel(&result, PyObject_Repr(self->tzinfo));
/* Add a closing paren. */
! PyString_ConcatAndDel(&result, PyString_FromString(")"));
return result;
}