FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-117398: datetime: Use wrappers for C-API functions by neonene · Pull Request #118115 · python/cpython · GitHub

/ cpython Public

gh-117398: datetime: Use wrappers for C-API functions - #118115

Closed
neonene wants to merge 9 commits into
python:mainfrom
neonene:wrapper
Closed

gh-117398: datetime: Use wrappers for C-API functions#118115
neonene wants to merge 9 commits into
python:mainfrom
neonene:wrapper

Conversation

neonene commented Apr 19, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

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 the new_datetime_ex funcion
  • new_time_nofold_capi(), renamed from new_time_ex, as it is internally unused.
  • new_timezone_capi() wraps the new_timezone funcion
  • new_datetime_capi() wraps the new_datetime_ex2 funcion
  • new_time_capi() wraps the new_time_ex2 funcion
  • new_date_capi() wraps the new_date_ex function
  • new_delta_capi() wraps the new_delta_ex function
  • datetime_fromtimestamp_capi() wraps the datetime_fromtimestamp function

Subsequently, 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.

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.
Comment thread Modules/_datetimemodule.c Outdated
}

static PyObject *
new_datetime_ex_capi(int year, int month, int day, int hour, int minute,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think that "_ex" is useful. Just rename it to "new_datetime_capi", no? Same remark for other functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Your suggestion includes non-capi functions?

neonene commented Apr 21, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

87408a9 is an attempt to strip _ex? from the non-capi functions except reduce().

neonene closed this May 23, 2024
neonene deleted the wrapper branch May 23, 2024 14:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL