gh-71587: Drop local reference cache to _strptime module in _datetime#120224
gh-71587: Drop local reference cache to _strptime module in _datetime#120224ericsnowcurrently merged 10 commits into
_strptime module in _datetime#120224Conversation
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
_strptime module in _datetime
kumaraditya303
left a comment
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@kumaraditya303 Thanks for the review. @ericsnowcurrently Maybe off-topic now, but is it possible to access the module state through a static type like: // pycore_typeobject.h
typedef struct {
PyTypeObject *type;
int isbuiltin;
....
+ PyObject *current_ext_module // weak ref? or borrowed ref?
} managed_static_type_state;Then, |
Sorry, something went wrong.
That definitely could work. It's worth looking into for 3.14. |
Sorry, something went wrong.
ericsnowcurrently
left a comment
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
This should be backported to 3.13, right? |
Sorry, something went wrong.
|
I agree to the 3.13 backport. |
Sorry, something went wrong.
|
Thanks @neonene for the PR, and @ericsnowcurrently for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
…_datetime` (pythongh-120224) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()). (cherry picked from commit 127c1d2) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
|
I just realized this fixes a long-standing problem and is not related to the recent work on |
Sorry, something went wrong.
|
Thanks @neonene for the PR, and @ericsnowcurrently for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
|
Sorry, @neonene and @ericsnowcurrently, I could not cleanly backport this to |
Sorry, something went wrong.
|
@neonene, would you have time to do the 3.12 backport? I'm sure it won't require much effort. |
Sorry, something went wrong.
…`_datetime` (gh-120424) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()). (cherry picked from commit 127c1d2, AKA gh-120224) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
|
Thanks @ericsnowcurrently, @erlend-aasland for reviewing this, and thanks again @kumaraditya303. |
Sorry, something went wrong.
…`_datetime` (gh-120431) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()). (cherry picked from commit 127c1d2, AKA gh-120224)
…_datetime` (pythongh-120224) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()).
…_datetime` (pythongh-120224) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()).
…_datetime` (pythongh-120224) The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation). That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters. This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()).
For 3.13 and newer, this PR fixes the following errors
by making each loadedby importing_datetimemodule use its own reference cache to_strptimemodule. The cache will be the same as the reference insys.modulesof the corresponding interpreter_strptimemodule on eachstrptime()function call.Main interpreter:
Sub interpreter:
cc @ericsnowcurrently @erlend-aasland