File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,6 +170,31 @@ and the type is not checked:
170170 Return the microsecond, as an int from 0 through 999999.
171171
172172
173+ Macros to extract fields from time delta objects. The argument must be an
174+ instance of :c:data: `PyDateTime_Delta `, including subclasses. The argument must
175+ not be *NULL *, and the type is not checked:
176+
177+ .. c :function :: int PyDateTime_DELTA_GET_DAYS (PyDateTime_Delta *o)
178+
179+ Return the number of days, as an int from -999999999 to 999999999.
180+
181+ .. versionadded :: 3.3
182+
183+
184+ .. c :function :: int PyDateTime_DELTA_GET_SECONDS (PyDateTime_Delta *o)
185+
186+ Return the number of seconds, as an int from 0 through 86399.
187+
188+ .. versionadded :: 3.3
189+
190+
191+ .. c :function :: int PyDateTime_DELTA_GET_MICROSECOND (PyDateTime_Delta *o)
192+
193+ Return the number of microseconds, as an int from 0 through 999999.
194+
195+ .. versionadded :: 3.3
196+
197+
173198Macros for the convenience of modules implementing the DB API:
174199
175200.. c :function :: PyObject* PyDateTime_FromTimestamp (PyObject *args)
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ typedef struct
135135 (((PyDateTime_Time*)o)->data[4] << 8) | \
136136 ((PyDateTime_Time*)o)->data[5])
137137
138+ /* Apply for time delta instances */
139+ #define PyDateTime_DELTA_GET_DAYS (o ) (((PyDateTime_Delta*)o)->days)
140+ #define PyDateTime_DELTA_GET_SECONDS (o ) (((PyDateTime_Delta*)o)->seconds)
141+ #define PyDateTime_DELTA_GET_MICROSECONDS (o ) \
142+ (((PyDateTime_Delta*)o)->microseconds)
143+
138144
139145/* Define structure for C API. */
140146typedef struct {
Original file line number Diff line number Diff line change @@ -2056,6 +2056,10 @@ Tests
20562056C-API
20572057-----
20582058
2059+ - Issue #13727: Add 3 macros to access PyDateTime_Delta members:
2060+ PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS,
2061+ PyDateTime_DELTA_GET_MICROSECONDS.
2062+
20592063- Issue #10542: Add 4 macros to work with surrogates: Py_UNICODE_IS_SURROGATE,
20602064 Py_UNICODE_IS_HIGH_SURROGATE, Py_UNICODE_IS_LOW_SURROGATE,
20612065 Py_UNICODE_JOIN_SURROGATES.
You can’t perform that action at this time.
0 commit comments