[Python-checkins] python/dist/src/Include datetime.h,1.1,1.2
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Thu, 09 Jan 2003 19:49:04 -0800
Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv26942/python/Include
Modified Files:
datetime.h
Log Message:
Got rid of the timetz type entirely. This was a bit trickier than I
hoped it would be, but not too bad. A test had to change:
time.__setstate__() can no longer add a non-None tzinfo member to a time
object that didn't already have one, since storage for a tzinfo member
doesn't exist in that case.
Index: datetime.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/datetime.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** datetime.h 16 Dec 2002 20:17:53 -0000 1.1
--- datetime.h 10 Jan 2003 03:49:02 -0000 1.2
***************
*** 28,31 ****
--- 28,36 ----
#define _PyDateTime_DATETIME_DATASIZE 10
+ #define _PyTZINFO_HEAD \
+ PyObject_HEAD \
+ long hashcode; \
+ char hastzinfo; /* boolean flag */
+
typedef struct
{
***************
*** 50,67 ****
} PyDateTime_DateTimeTZ;
typedef struct
{
! PyObject_HEAD
! long hashcode;
! unsigned char data[_PyDateTime_TIME_DATASIZE];
! } PyDateTime_Time;
typedef struct
{
! PyObject_HEAD
! long hashcode;
! unsigned char data[_PyDateTime_TIME_DATASIZE];
PyObject *tzinfo;
! } PyDateTime_TimeTZ;
typedef struct
--- 55,75 ----
} PyDateTime_DateTimeTZ;
+
+
+ #define _PyDateTime_TIMEHEAD \
+ _PyTZINFO_HEAD \
+ unsigned char data[_PyDateTime_TIME_DATASIZE];
+
typedef struct
{
! _PyDateTime_TIMEHEAD
! } _PyDateTime_BaseTime; /* hastzinfo false */
typedef struct
{
! _PyDateTime_TIMEHEAD
PyObject *tzinfo;
! } PyDateTime_Time; /* hastzinfo true */
!
typedef struct
***************
*** 93,97 ****
((PyDateTime_DateTime*)o)->data[9])
! /* Apply for time and timetz instances. */
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
--- 101,105 ----
((PyDateTime_DateTime*)o)->data[9])
! /* Apply for time instances. */
#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0])
#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1])
***************
*** 113,119 ****
#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
#define PyTime_CheckExact(op) ((op)->ob_type == &PyDateTime_TimeType)
-
- #define PyTimeTZ_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeTZType)
- #define PyTimeTZ_CheckExact(op) ((op)->ob_type == &PyDateTime_TimeTZType)
#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
--- 121,124 ----