| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
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, get_current_module(&PyDateTime_DateType, &reloading) in _datetimemodule.c? |
Sorry, something went wrong.
That definitely could work. It's worth looking into for 3.14. |
Sorry, something went wrong.
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>
|
GH-120424 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
|
I just realized this fixes a long-standing problem and is not related to the recent work on _datetime. I'm guessing it would make sense to backport this to 3.12. (It's too late for 3.11.) |
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 3.12 due to a conflict. cherry_picker 127c1d2771749853e287632c086b6054212bf12a 3.12 |
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>
|
GH-120431 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
|
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()).
| Back | FazBrowse Home | New Git URL |
For 3.13 and newer, this PR fixes the following errors by making each loaded _datetime module use its own reference cache to _strptime module. The cache will be the same as the reference in sys.modules of the corresponding interpreter by importing _strptime module on each strptime() function call.
Main interpreter:
>_testembed_d test_repeated_init_exec "import datetime; datetime.datetime.strptime('200001', '%Y%m')" --- Loop #1 --- --- Loop #2 --- Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: 'NoneType' object is not callableSub interpreter:
>>> import _interpreters >>> for i in range(1,3): ... print('Sub Loop', i) ... interp = _interpreters.create() ... s = "import datetime; datetime.datetime.strptime('200001', '%Y%m')" ... _interpreters.run_string(interp, s) ... _interpreters.destroy(interp) ... Sub Loop 1 Sub Loop 2 Assertion failed: PyUnicode_CheckExact(ep_key), file C:\cp\Objects\dictobject.c, line 1126cc @ericsnowcurrently @erlend-aasland