[Python-checkins] python/dist/src/Modules datetimemodule.c,1.33,1.34

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年1月08日 12:40:42 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv5753/python/Modules
Modified Files:
	datetimemodule.c 
Log Message:
Utterly minimal changes to collapse datetimetz into datetime, and timetz
into time. This is little more than *exporting* the datetimetz object
under the name "datetime", and similarly for timetz. A good implementation
of this change requires more work, but this is fully functional if you
don't stare too hard at the internals (e.g., right now a type named
"datetime" shows up as a base class of the type named "datetime"). The
docs also need extensive revision, not part of this checkin.
Index: datetimemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** datetimemodule.c	8 Jan 2003 16:28:45 -0000	1.33
--- datetimemodule.c	8 Jan 2003 20:40:01 -0000	1.34
***************
*** 3346,3353 ****
 datetime_gettime(PyDateTime_DateTime *self)
 {
! 	return new_time(DATE_GET_HOUR(self),
! 			DATE_GET_MINUTE(self),
! 			DATE_GET_SECOND(self),
! 			DATE_GET_MICROSECOND(self));
 }
 
--- 3346,3354 ----
 datetime_gettime(PyDateTime_DateTime *self)
 {
! 	return new_timetz(DATE_GET_HOUR(self),
! 			 DATE_GET_MINUTE(self),
! 			 DATE_GET_SECOND(self),
! 			 DATE_GET_MICROSECOND(self),
! 			 Py_None);
 }
 
***************
*** 3458,3463 ****
 
 	{"time", (PyCFunction)datetime_gettime, METH_NOARGS,
! PyDoc_STR("Return time object with same hour, minute, second and "
! 	 "microsecond.")},
 
 	{"ctime", (PyCFunction)datetime_ctime,	METH_NOARGS,
--- 3459,3463 ----
 
 	{"time", (PyCFunction)datetime_gettime, METH_NOARGS,
! PyDoc_STR("Return time object with same time but with tzinfo=None.")},
 
 	{"ctime", (PyCFunction)datetime_ctime,	METH_NOARGS,
***************
*** 4404,4408 ****
 	PyObject_HEAD_INIT(NULL)
 	0,					/* ob_size */
! 	"datetime.timetz",			/* tp_name */
 	sizeof(PyDateTime_TimeTZ),		/* tp_basicsize */
 	0,					/* tp_itemsize */
--- 4404,4408 ----
 	PyObject_HEAD_INIT(NULL)
 	0,					/* ob_size */
! 	"datetime.time",			/* tp_name */
 	sizeof(PyDateTime_TimeTZ),		/* tp_basicsize */
 	0,					/* tp_itemsize */
***************
*** 5120,5124 ****
 	PyObject_HEAD_INIT(NULL)
 	0,					/* ob_size */
! 	"datetime.datetimetz",			/* tp_name */
 	sizeof(PyDateTime_DateTimeTZ),		/* tp_basicsize */
 	0,					/* tp_itemsize */
--- 5120,5124 ----
 	PyObject_HEAD_INIT(NULL)
 	0,					/* ob_size */
! 	"datetime.datetime",			/* tp_name */
 	sizeof(PyDateTime_DateTimeTZ),		/* tp_basicsize */
 	0,					/* tp_itemsize */
***************
*** 5425,5446 ****
 	PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType);
 
- 	Py_INCREF(&PyDateTime_DateTimeType);
- 	PyModule_AddObject(m, "datetime",
- 			 (PyObject *) &PyDateTime_DateTimeType);
- 
 	Py_INCREF(&PyDateTime_DeltaType);
 	PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType);
 
- 	Py_INCREF(&PyDateTime_TimeType);
- 	PyModule_AddObject(m, "time", (PyObject *) &PyDateTime_TimeType);
- 
 	Py_INCREF(&PyDateTime_TZInfoType);
 	PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType);
 
 	Py_INCREF(&PyDateTime_TimeTZType);
! 	PyModule_AddObject(m, "timetz", (PyObject *) &PyDateTime_TimeTZType);
 
 	Py_INCREF(&PyDateTime_DateTimeTZType);
! 	PyModule_AddObject(m, "datetimetz",
 			 (PyObject *)&PyDateTime_DateTimeTZType);
 
--- 5425,5439 ----
 	PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType);
 
 	Py_INCREF(&PyDateTime_DeltaType);
 	PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType);
 
 	Py_INCREF(&PyDateTime_TZInfoType);
 	PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType);
 
 	Py_INCREF(&PyDateTime_TimeTZType);
! 	PyModule_AddObject(m, "time", (PyObject *) &PyDateTime_TimeTZType);
 
 	Py_INCREF(&PyDateTime_DateTimeTZType);
! 	PyModule_AddObject(m, "datetime",
 			 (PyObject *)&PyDateTime_DateTimeTZType);
 

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