]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-71587: Drop local reference cache to `_strptime` module in `_datetime`...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 12 Jun 2024 17:15:16 +0000 (19:15 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2024 17:15:16 +0000 (17:15 +0000)
commit0041087aa12044223103c7b8a3ca07d896652ab9
tree4be4723449a1658a18a46177c6954a124692ea63
parent8e5caa72c2556c4ba1fb90dfc6593bb848a6c116
[3.13] gh-71587: Drop local reference cache to `_strptime` module in `_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 127c1d2771749853e287632c086b6054212bf12a, AKA gh-120224)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
Include/internal/pycore_global_objects_fini_generated.h
Include/internal/pycore_global_strings.h
Include/internal/pycore_runtime_init_generated.h
Include/internal/pycore_unicodeobject_generated.h
Lib/test/test_embed.py
Misc/NEWS.d/next/Library/2024-06-07-11-23-31.gh-issue-71587.IjFajE.rst [new file with mode: 0644]
Modules/_datetimemodule.c
Tools/c-analyzer/cpython/globals-to-fix.tsv