Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-117398: gh-119655: datetime: Init static state once & don't free it#119662
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
encukou commented May 28, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| // (capsule == NULL){is handled by PyModule_Add | ||
| 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.
ericsnowcurrently left a comment
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.ericsnowcurrently commented May 28, 2024
I'll take care of backporting this to 3.13 (by adding it into gh-119641). |
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented May 28, 2024
|
…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)
erlend-aasland commented May 28, 2024
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)
capiis static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)