bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212)

Automerge-Triggered-By: GH:tiran
This commit is contained in:
Christian Heimes 2022-03-31 18:14:50 +03:00 committed by GitHub
parent 5458b7e39e
commit 44e915028d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -343,6 +343,11 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
self.assertEqual(out, 'Tests passed\n' * INIT_LOOPS)
def test_ucnhash_capi_reset(self):
# bpo-47182: unicodeobject.c:ucnhash_capi was not reset on shutdown.
code = "print('\\N{digit nine}')"
out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
self.assertEqual(out, '9\n' * INIT_LOOPS)
class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
maxDiff = 4096