Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gh-71587: Clear cached strptime module #101783

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

abalkin
Copy link
Member

@abalkin abalkin commented Feb 10, 2023

@ghost
Copy link

ghost commented Feb 10, 2023

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

@@ -6863,12 +6864,17 @@ _datetime_exec(PyObject *module)
return 0;
}

static void module_free(void*) {
strptime_module = NULL;
Copy link
Member Author

Choose a reason for hiding this comment

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

We should call Py_CLEAR here to avoid leaking a reference.

@abalkin abalkin linked an issue Feb 10, 2023 that may be closed by this pull request
@zooba
Copy link
Member

zooba commented Feb 10, 2023

This approach isn't going to be any better than the existing one. It needs to be written in a way that doesn't use global variables at all (static inside a function is effectively a global variable).

@StanFromIreland
Copy link
Contributor

This can be closed, the issue is complete.

@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

The following commit authors need to sign the Contributor License Agreement:

CLA signed

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datetime NoneType after calling Py_Finalize and Py_Initialize
5 participants