Skip to content

Commit 7bbce38

Browse files
authored
add a test
1 parent f8290df commit 7bbce38

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_embed.py

+6
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ def test_ucnhash_capi_reset(self):
404404
out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
405405
self.assertEqual(out, '9\n' * INIT_LOOPS)
406406

407+
def test_datetime_type_dict(self):
408+
# Test use-after-free of unicode keys in tp_dict
409+
code = "import datetime; print(datetime.date.min)"
410+
out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
411+
self.assertEqual(out, '0001-01-01\n'* INIT_LOOPS)
412+
407413

408414
@unittest.skipIf(_testinternalcapi is None, "requires _testinternalcapi")
409415
class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):

0 commit comments

Comments
 (0)