Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 3 commits into from
May 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not free the static capi
  • Loading branch information
encukou committed May 28, 2024
commit 2f7970de2275f8e3346f7d7b3253db4e23864668
6 changes: 1 addition & 5 deletions 6 Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -7017,12 +7017,8 @@ _datetime_exec(PyObject *module)
goto error;
}
PyObject *capsule = PyCapsule_New(capi, PyDateTime_CAPSULE_NAME, NULL);
if (capsule == NULL) {
PyMem_Free(capi);
goto error;
}
// (capsule == NULL) {is handled by PyModule_Add
Copy link
Member

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.

encukou marked this conversation as resolved.
Show resolved Hide resolved
if (PyModule_Add(module, "datetime_CAPI", capsule) < 0) {
PyMem_Free(capi);
Copy link
Member

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?

Copy link
Member Author

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.

goto error;
}

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.