Repository navigation
bpo-10381: Add timezone to datetime C API #5032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7f1878b
20676ae
4a1bab6
8728bd7
2c20871
0398e3c
70642af
9303050
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,18 @@ Type-check macros: | |
| *NULL*. | ||
|
|
||
|
|
||
| .. c:function:: int PyTimeZone_Check(PyObject *ob) | ||
|
|
||
| Return true if *ob* is of type :c:data:`PyDateTime_TimeZoneType` or a subtype of | ||
| :c:data:`PyDateTime_TimeZoneType`. *ob* must not be *NULL*. | ||
|
|
||
|
|
||
| .. c:function:: int PyTimeZone_CheckExact(PyObject *ob) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are not exposing PyDateTime_TimeZone struct, I don't see the utility of having PyTimeZone_Check macros. Maybe something like PyTZInfo_Check as an accelerated version of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just remove the |
||
|
|
||
| Return true if *ob* is of type :c:data:`PyDateTime_TimeZoneType`. *ob* must not be | ||
| *NULL*. | ||
|
|
||
|
|
||
| Macros to create objects: | ||
|
|
||
| .. c:function:: PyObject* PyDate_FromDate(int year, int month, int day) | ||
|
|
@@ -101,6 +113,20 @@ Macros to create objects: | |
| number of microseconds and seconds lie in the ranges documented for | ||
| ``datetime.timedelta`` objects. | ||
|
|
||
| .. c:function:: PyObject* PyTimeZone_FromOffset(PyDateTime_DeltaType* offset) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I build the documentation, I see Return value: New reference. under all the constructor macros except these two, but I'm not sure where that's being generated from. I don't see why they wouldn't be a new reference, but I don't 100% grok when something does and does not change the reference count.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reference counting information is stored in Doc/data/refcounts.dat
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @abalkin When documenting the reference counts, I ran into a bit of a problem, since the reference to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to merge this now. We can fine tune the documentation during the beta phase. |
||
|
|
||
| Return a ``datetime.timezone`` object with an unnamed fixed offset | ||
| represented by the *offset* argument. | ||
|
|
||
| .. versionadded:: 3.7 | ||
|
|
||
| .. c:function:: PyObject* PyTimeZone_FromOffsetAndName(PyDateTime_DeltaType* offset, PyUnicode* name) | ||
|
|
||
| Return a ``datetime.timezone`` object with a fixed offset represented by | ||
| the *offset* argument and with tzname *name*. | ||
|
|
||
| .. versionadded:: 3.7 | ||
|
|
||
|
|
||
| Macros to extract fields from date objects. The argument must be an instance of | ||
| :c:data:`PyDateTime_Date`, including subclasses (such as | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the typezone type cannot be subclassed: