[Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.26,1.27 obj_time.c,1.9,1.10

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


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv9892
Modified Files:
	obj_delta.c obj_time.c 
Log Message:
More use of typecheck macros.
Index: obj_delta.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** obj_delta.c	9 Dec 2002 02:20:34 -0000	1.26
--- obj_delta.c	13 Dec 2002 19:22:32 -0000	1.27
***************
*** 170,175 ****
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType) &&
! 	 PyType_IsSubtype(right->ob_type, &PyDateTime_DeltaType)) {
 		/* delta + delta */
 		/* The C-level additions can't overflow because of the
--- 170,174 ----
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyDelta_Check(left) && PyDelta_Check(right)) {
 		/* delta + delta */
 		/* The C-level additions can't overflow because of the
***************
*** 230,235 ****
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType) &&
! 	 PyType_IsSubtype(right->ob_type, &PyDateTime_DeltaType)) {
 	 	/* delta - delta */
 	 	PyObject *minus_right = PyNumber_Negative(right);
--- 229,233 ----
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyDelta_Check(left) && PyDelta_Check(right)) {
 	 	/* delta - delta */
 	 	PyObject *minus_right = PyNumber_Negative(right);
***************
*** 256,260 ****
 	long diff;
 
! 	if (! PyObject_TypeCheck(other, &PyDateTime_DeltaType)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare %s to %s instance",
--- 254,258 ----
 	long diff;
 
! 	if (! PyDelta_CheckExact(other)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare %s to %s instance",
***************
*** 292,296 ****
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType)) {
 		/* delta * ??? */
 		if (PyInt_Check(right) || PyLong_Check(right))
--- 290,294 ----
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyDelta_Check(left)) {
 		/* delta * ??? */
 		if (PyInt_Check(right) || PyLong_Check(right))
***************
*** 312,316 ****
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType)) {
 		/* delta * ??? */
 		if (PyInt_Check(right) || PyLong_Check(right))
--- 310,314 ----
 	PyObject *result = Py_NotImplemented;
 
! 	if (PyDelta_Check(left)) {
 		/* delta * ??? */
 		if (PyInt_Check(right) || PyLong_Check(right))
Index: obj_time.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_time.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** obj_time.c	13 Dec 2002 16:43:25 -0000	1.9
--- obj_time.c	13 Dec 2002 19:22:37 -0000	1.10
***************
*** 137,141 ****
 	long diff;
 
! 	if (!PyType_IsSubtype(other->ob_type, &PyDateTime_TimeType)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare time to %s instance",
--- 137,141 ----
 	long diff;
 
! 	if (! PyTime_Check(other)) {
 		PyErr_Format(PyExc_TypeError,
 			 "can't compare time to %s instance",

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