@@ -8,11 +8,54 @@ DateTime Objects
88Various date and time objects are supplied by the :mod: `datetime ` module.
99Before using any of these functions, the header file :file: `datetime.h ` must be
1010included in your source (note that this is not included by :file: `Python.h `),
11- and the macro :c:macro: `PyDateTime_IMPORT ` must be invoked, usually as part of
11+ and the macro :c:macro: `! PyDateTime_IMPORT ` must be invoked, usually as part of
1212the module initialisation function. The macro puts a pointer to a C structure
13- into a static variable, :c:data: `PyDateTimeAPI `, that is used by the following
13+ into a static variable, :c:data: `! PyDateTimeAPI `, that is used by the following
1414macros.
1515
16+ .. c :type :: PyDateTime_Date
17+
18+ This subtype of :c:type: `PyObject ` represents a Python date object.
19+
20+ .. c :type :: PyDateTime_DateTime
21+
22+ This subtype of :c:type: `PyObject ` represents a Python datetime object.
23+
24+ .. c :type :: PyDateTime_Time
25+
26+ This subtype of :c:type: `PyObject ` represents a Python time object.
27+
28+ .. c :type :: PyDateTime_Delta
29+
30+ This subtype of :c:type: `PyObject ` represents the difference between two datetime values.
31+
32+ .. c :var :: PyTypeObject PyDateTime_DateType
33+
34+ This instance of :c:type: `PyTypeObject ` represents the Python date type;
35+ it is the same object as :class: `datetime.date ` in the Python layer.
36+
37+ .. c :var :: PyTypeObject PyDateTime_DateTimeType
38+
39+ This instance of :c:type: `PyTypeObject ` represents the Python datetime type;
40+ it is the same object as :class: `datetime.datetime ` in the Python layer.
41+
42+ .. c :var :: PyTypeObject PyDateTime_TimeType
43+
44+ This instance of :c:type: `PyTypeObject ` represents the Python time type;
45+ it is the same object as :class: `datetime.time ` in the Python layer.
46+
47+ .. c :var :: PyTypeObject PyDateTime_DeltaType
48+
49+ This instance of :c:type: `PyTypeObject ` represents Python type for
50+ the difference between two datetime values;
51+ it is the same object as :class: `datetime.timedelta ` in the Python layer.
52+
53+ .. c :var :: PyTypeObject PyDateTime_TZInfoType
54+
55+ This instance of :c:type: `PyTypeObject ` represents the Python time zone info type;
56+ it is the same object as :class: `datetime.tzinfo ` in the Python layer.
57+
58+
1659Macro for access to the UTC singleton:
1760
1861.. c :var :: PyObject* PyDateTime_TimeZone_UTC
@@ -28,7 +71,7 @@ Type-check macros:
2871.. c :function :: int PyDate_Check (PyObject *ob)
2972
3073 Return true if *ob * is of type :c:data: `PyDateTime_DateType ` or a subtype of
31- :c:data: `PyDateTime_DateType `. *ob * must not be ``NULL ``. This function always
74+ :c:data: `! PyDateTime_DateType `. *ob * must not be ``NULL ``. This function always
3275 succeeds.
3376
3477
@@ -41,7 +84,7 @@ Type-check macros:
4184.. c :function :: int PyDateTime_Check (PyObject *ob)
4285
4386 Return true if *ob * is of type :c:data: `PyDateTime_DateTimeType ` or a subtype of
44- :c:data: `PyDateTime_DateTimeType `. *ob * must not be ``NULL ``. This function always
87+ :c:data: `! PyDateTime_DateTimeType `. *ob * must not be ``NULL ``. This function always
4588 succeeds.
4689
4790
@@ -54,7 +97,7 @@ Type-check macros:
5497.. c :function :: int PyTime_Check (PyObject *ob)
5598
5699 Return true if *ob * is of type :c:data: `PyDateTime_TimeType ` or a subtype of
57- :c:data: `PyDateTime_TimeType `. *ob * must not be ``NULL ``. This function always
100+ :c:data: `! PyDateTime_TimeType `. *ob * must not be ``NULL ``. This function always
58101 succeeds.
59102
60103
@@ -67,7 +110,7 @@ Type-check macros:
67110.. c :function :: int PyDelta_Check (PyObject *ob)
68111
69112 Return true if *ob * is of type :c:data: `PyDateTime_DeltaType ` or a subtype of
70- :c:data: `PyDateTime_DeltaType `. *ob * must not be ``NULL ``. This function always
113+ :c:data: `! PyDateTime_DeltaType `. *ob * must not be ``NULL ``. This function always
71114 succeeds.
72115
73116
@@ -80,7 +123,7 @@ Type-check macros:
80123.. c :function :: int PyTZInfo_Check (PyObject *ob)
81124
82125 Return true if *ob * is of type :c:data: `PyDateTime_TZInfoType ` or a subtype of
83- :c:data: `PyDateTime_TZInfoType `. *ob * must not be ``NULL ``. This function always
126+ :c:data: `! PyDateTime_TZInfoType `. *ob * must not be ``NULL ``. This function always
84127 succeeds.
85128
86129
@@ -133,15 +176,15 @@ Macros to create objects:
133176 :class:`datetime.timedelta` objects.
134177
135178
136- .. c:function:: PyObject* PyTimeZone_FromOffset(PyDateTime_DeltaType* offset)
179+ .. c:function:: PyObject* PyTimeZone_FromOffset(PyObject * offset)
137180
138181 Return a :class: `datetime.timezone ` object with an unnamed fixed offset
139182 represented by the *offset * argument.
140183
141184 .. versionadded :: 3.7
142185
143186
144- .. c:function:: PyObject* PyTimeZone_FromOffsetAndName(PyDateTime_DeltaType* offset, PyUnicode* name)
187+ .. c :function :: PyObject* PyTimeZone_FromOffsetAndName (PyObject * offset, PyObject * name)
145188
146189 Return a :class: `datetime.timezone ` object with a fixed offset represented
147190 by the *offset * argument and with tzname *name *.
@@ -150,8 +193,8 @@ Macros to create objects:
150193
151194
152195Macros to extract fields from date objects. The argument must be an instance of
153- :c:data :`PyDateTime_Date`, including subclasses (such as
154- :c:data : `PyDateTime_DateTime `). The argument must not be ``NULL``, and the type is
196+ :c:type : `PyDateTime_Date `, including subclasses (such as
197+ :c:type : `PyDateTime_DateTime `). The argument must not be ``NULL``, and the type is
155198not checked:
156199
157200.. c:function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o)
@@ -170,7 +213,7 @@ not checked:
170213
171214
172215Macros to extract fields from datetime objects. The argument must be an
173- instance of :c:data : `PyDateTime_DateTime `, including subclasses. The argument
216+ instance of :c:type : `PyDateTime_DateTime `, including subclasses. The argument
174217must not be ``NULL ``, and the type is not checked:
175218
176219.. c :function :: int PyDateTime_DATE_GET_HOUR (PyDateTime_DateTime *o)
@@ -208,7 +251,7 @@ must not be ``NULL``, and the type is not checked:
208251
209252
210253Macros to extract fields from time objects. The argument must be an instance of
211- :c:data :`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
254+ :c:type :`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
212255and the type is not checked:
213256
214257.. c:function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o)
@@ -246,7 +289,7 @@ and the type is not checked:
246289
247290
248291Macros to extract fields from time delta objects. The argument must be an
249- instance of :c:data :`PyDateTime_Delta`, including subclasses. The argument must
292+ instance of :c:type :`PyDateTime_Delta`, including subclasses. The argument must
250293not be ``NULL``, and the type is not checked:
251294
252295.. c:function:: int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o)
0 commit comments