[Python-checkins] python/nondist/sandbox/datetime obj_time.c,1.10,1.11 obj_timetz.c,1.20,1.21

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年12月13日 11:25:45 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv10913
Modified Files:
	obj_time.c obj_timetz.c 
Log Message:
More use of typecheck macros.
Index: obj_time.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_time.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** obj_time.c	13 Dec 2002 19:22:37 -0000	1.10
--- obj_time.c	13 Dec 2002 19:25:34 -0000	1.11
***************
*** 207,211 ****
 	PyObject *result = NULL;
 
! 	if (time->ob_type != &PyDateTime_TimeType) {
 		PyErr_Format(PyExc_TypeError,
 			 "bad type passed to time pickler: %s",
--- 207,211 ----
 	PyObject *result = NULL;
 
! 	if (! PyTime_CheckExact(time)) {
 		PyErr_Format(PyExc_TypeError,
 			 "bad type passed to time pickler: %s",
Index: obj_timetz.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_timetz.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** obj_timetz.c	13 Dec 2002 16:43:28 -0000	1.20
--- obj_timetz.c	13 Dec 2002 19:25:36 -0000	1.21
***************
*** 181,185 ****
 	long diff;
 
! 	if (!PyType_IsSubtype(other->ob_type, &PyDateTime_TimeType)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare 'timetz' to '%s'",
--- 181,185 ----
 	long diff;
 
! 	if (! PyTime_Check(other)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare 'timetz' to '%s'",
***************
*** 189,196 ****
 
 	self_tzinfo = self->tzinfo;
! 	other_tzinfo = PyType_IsSubtype(other->ob_type,
! 					 &PyDateTime_TimeTZType) ?
! 			((PyDateTime_TimeTZ *)other)->tzinfo :
! 			Py_None;
 
 	if (self_tzinfo == other_tzinfo)
--- 189,195 ----
 
 	self_tzinfo = self->tzinfo;
! 	other_tzinfo = PyTimeTZ_Check(other) ?
! 				((PyDateTime_TimeTZ *)other)->tzinfo :
! 				Py_None;
 
 	if (self_tzinfo == other_tzinfo)
***************
*** 365,369 ****
 	PyObject *result = NULL;
 
! 	if (timetz->ob_type != &PyDateTime_TimeTZType) {
 		PyErr_Format(PyExc_TypeError,
 			 "bad type passed to timetz pickler: %s",
--- 364,368 ----
 	PyObject *result = NULL;
 
! 	if (! PyTimeTZ_CheckExact(timetz)) {
 		PyErr_Format(PyExc_TypeError,
 			 "bad type passed to timetz pickler: %s",

AltStyle によって変換されたページ (->オリジナル) /