-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-117398: datetime: Use wrappers for C-API functions #118115
Conversation
This introduces the following wrapper functions for the public C-API, so that the wrapped functions (`_capi` un-suffixed) can have more arguments, such as a module state: * `new_datetime_ex_capi()` * `new_time_ex_capi()`, renamed from `new_time_ex`, as it is internally unused. * `new_timezone_capi()` * `new_datetime_ex2_capi()` * `new_time_ex2_capi()` The wrappers need to get a module state from the C-API class or a given object's type.
Modules/_datetimemodule.c
Outdated
@@ -1047,6 +1047,24 @@ new_datetime_ex(int year, int month, int day, int hour, int minute, | |||
tzinfo, 0, type); | |||
} | |||
|
|||
static PyObject * | |||
new_datetime_ex_capi(int year, int month, int day, int hour, int minute, |
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.
I don't think that "_ex" is useful. Just rename it to "new_datetime_capi", no? Same remark for other functions.
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.
Your suggestion includes non-capi functions?
87408a9 is an attempt to strip |
This introduces the following wrapper functions for the public C-API, so that the wrapped functions can have more arguments, such as a module state:
new_datetime_nofold_capi()
wraps thenew_datetime_ex
funcionnew_time_nofold_capi()
, renamed fromnew_time_ex
, as it is internally unused.new_timezone_capi()
wraps thenew_timezone
funcionnew_datetime_capi()
wraps thenew_datetime_ex2
funcionnew_time_capi()
wraps thenew_time_ex2
funcionnew_date_capi()
wraps thenew_date_ex
functionnew_delta_capi()
wraps thenew_delta_ex
functiondatetime_fromtimestamp_capi()
wraps thedatetime_fromtimestamp
functionSubsequently, some internal
*_ex?()
functions are renamed as well.The wrappers need to get a module state from the C-API class or a given object's type.
cc @vstinner @erlend-aasland: I'd like to prepare as much as possible.