File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -7269,7 +7269,28 @@ def test_update_type_cache(self):
72697269 assert isinstance(_datetime.timezone.utc, _datetime.tzinfo)
72707270 del sys.modules['_datetime']
72717271 """ )
7272- script_helper .assert_python_ok ('-c' , script )
7272+ res = script_helper .assert_python_ok ('-c' , script )
7273+ self .assertFalse (res .err )
7274+
7275+ def test_module_state_at_shutdown (self ):
7276+ # gh-132413
7277+ script = textwrap .dedent ("""
7278+ import sys
7279+ import _datetime
7280+
7281+ def gen():
7282+ try:
7283+ yield
7284+ finally:
7285+ assert not sys.modules
7286+ td = _datetime.timedelta(days=1) # crash
7287+ assert td.days == 1
7288+
7289+ it = gen()
7290+ next(it)
7291+ """ )
7292+ res = script_helper .assert_python_ok ('-c' , script )
7293+ self .assertFalse (res .err )
72737294
72747295
72757296def load_tests (loader , standard_tests , pattern ):
You can’t perform that action at this time.
0 commit comments