Skip to content

gh-132413: Clear weakref to _datetime after modules are finalized #136152

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

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
neonene authored Jun 30, 2025
commit 4f83cb00dd83b10090ed0611db2d15a0486ba40d
19 changes: 19 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7295,6 +7295,25 @@ def test_update_type_cache(self):
""")
script_helper.assert_python_ok('-c', script)

def test_static_type_at_shutdown(self):
# gh-132413
script = textwrap.dedent("""
import _datetime
timedelta = _datetime.timedelta

def gen():
try:
yield
finally:
# sys.modules is empty
_datetime.timedelta(days=1)
timedelta(days=1)

it = gen()
next(it)
""")
script_helper.assert_python_ok('-c', script)


def load_tests(loader, standard_tests, pattern):
standard_tests.addTest(ZoneInfoCompleteTest())
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy