-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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: gh-119655: datetime: Init static state once & don't free it #119662
Conversation
if (PyModule_Add(module, "datetime_CAPI", capsule) < 0) { | ||
PyMem_Free(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.
It's not correct to free capi here?
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.
capi
is static, we should not free it.
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.
LGTM
Modules/_datetimemodule.c
Outdated
PyMem_Free(capi); | ||
goto error; | ||
} | ||
// (capsule == NULL) {is handled by PyModule_Add |
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.
typo:
// (capsule == NULL) is handled by PyModule_Add.
I'll take care of backporting this to 3.13 (by adding it into gh-119641). |
|
…don't free it (pythonGH-119662) - While datetime uses global state, only initialize it once. - While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)
Thanks! |
…don't free it (pythonGH-119662) - While datetime uses global state, only initialize it once. - While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)
capi
is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)