summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-10 03:49:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-10 03:49:02 (GMT)
commit37f398282bf74b11e6167f7c7af75960e553dab9 (patch)
treeafcec2dd5f514160881b45747b76d28704a32c9f /Include
parenta5e8bb94e56bf5f1e304064c8f9dc96e87980326 (diff)
downloadcpython-37f398282bf74b11e6167f7c7af75960e553dab9.zip
cpython-37f398282bf74b11e6167f7c7af75960e553dab9.tar.gz
cpython-37f398282bf74b11e6167f7c7af75960e553dab9.tar.bz2
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.
Diffstat (limited to 'Include')
-rw-r--r--Include/datetime.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/Include/datetime.h b/Include/datetime.h
index 7bfbf0b..5c31162 100644
--- a/Include/datetime.h
+++ b/Include/datetime.h
@@ -27,6 +27,11 @@
/* # of bytes for year, month, day, hour, minute, second, and usecond. */
#define _PyDateTime_DATETIME_DATASIZE 10
+#define _PyTZINFO_HEAD \
+ PyObject_HEAD \
+ long hashcode; \
+ char hastzinfo; /* boolean flag */
+
typedef struct
{
PyObject_HEAD
@@ -49,20 +54,23 @@ typedef struct
PyObject *tzinfo;
} PyDateTime_DateTimeTZ;
+
+
+#define _PyDateTime_TIMEHEAD \
+ _PyTZINFO_HEAD \
+ unsigned char data[_PyDateTime_TIME_DATASIZE];
+
typedef struct
{
- PyObject_HEAD
- long hashcode;
- unsigned char data[_PyDateTime_TIME_DATASIZE];
-} PyDateTime_Time;
+ _PyDateTime_TIMEHEAD
+} _PyDateTime_BaseTime; /* hastzinfo false */
typedef struct
{
- PyObject_HEAD
- long hashcode;
- unsigned char data[_PyDateTime_TIME_DATASIZE];
+ _PyDateTime_TIMEHEAD
PyObject *tzinfo;
-} PyDateTime_TimeTZ;
+} PyDateTime_Time; /* hastzinfo true */
+
typedef struct
{
@@ -92,7 +100,7 @@ typedef struct
(((PyDateTime_DateTime*)o)->data[8] << 8) | \
((PyDateTime_DateTime*)o)->data[9])
-/* Apply for time and timetz instances. */
+/* 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])
#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2])
@@ -113,9 +121,6 @@ typedef struct
#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)
#define PyDelta_CheckExact(op) ((op)->ob_type == &PyDateTime_DeltaType)