Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
gh-71587: Isolate_datetime
#102995
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-71587: Isolate_datetime
#102995
Uh oh!
There was an error while loading.Please reload this page.
Conversation
erlend-aasland commentedMar 24, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Observations:
|
@ericsnowcurrently, regarding the datetime C API: Currently, the encapsulated datetime C API is exposed as a global variable: Lines 196 to 197 ine375bff
I guess we could move this to the interpreter state instead. Thoughts? FTR, if we run the ref leak bots on this PR, they fail because of the datetime C API tests in cpython/Modules/_testcapi/datetime.c Lines 8 to 29 ine375bff
|
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.
Would it be possible to split the PR into multiple parts? Example:
- PR 1: Add a module state, refer a few static types there, and pass the state to the easy places to retrieve the type
- PR 2: Slowly, convert static types, one by one
- PR 3: Dirty changes
- PR 4: The final beautiful change which just remove the old code
Definitely! |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -6830,7 +6897,7 @@ _datetime_exec(PyObject *module) | |||
return -1; | |||
} | |||
PyDateTime_CAPI *capi = get_datetime_capi(); | |||
PyDateTime_CAPI *capi = get_datetime_capi(st); |
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.
This function name is misleading. Can you please rename it to create_datetime_capi()?
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 agree, but I think we should do that in a separate PR. Theget_datetime_capi
is not introduced by this PR; it is already in place.
Uh oh!
There was an error while loading.Please reload this page.
.basicsize = sizeof(PyDateTime_DateTime), | ||
.flags = (Py_TPFLAGS_DEFAULT | | ||
Py_TPFLAGS_BASETYPE | | ||
Py_TPFLAGS_HAVE_GC | |
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.
Something is strange here. But you should better address it in a separated PR (to keep this one as small as possible). Apparently, PyObject_GC_Track() is simply never called and so Py_TPFLAGS_HAVE_GC, traverse() and clear() functions seem to alll be unused (useless).
Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading.Please reload this page.