summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2022-10-30 12:01:30 (GMT)
committerGitHub <noreply@github.com>2022-10-30 12:01:30 (GMT)
commit05e48865be69e1e5824f6915b588ff054717bb42 (patch)
tree716ac0f9e038f575b4212db6d4a7b6a76b484d59 /Lib/test/test_embed.py
parent76f989dc3e668d15b3ec9a90bf6530276530acac (diff)
downloadcpython-05e48865be69e1e5824f6915b588ff054717bb42.zip
cpython-05e48865be69e1e5824f6915b588ff054717bb42.tar.gz
cpython-05e48865be69e1e5824f6915b588ff054717bb42.tar.bz2
gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98212)
* As most of `test_embed` now uses `Py_InitializeFromConfig`, add a specific test case to cover `Py_Initialize` (and `Py_InitializeEx`) * Rename `_testembed` init helper to clarify the API used * Add a `PyConfig_Clear` call in `Py_InitializeEx` to make the code more obviously correct (it already didn't leak as none of the dynamically allocated config fields were being populated, but it's clearer if the wrappers follow the documented API usage guidelines)
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r--Lib/test/test_embed.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index f622d44..930f763 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -340,6 +340,12 @@ 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_simple_initialization_api(self):
+ # _testembed now uses Py_InitializeFromConfig by default
+ # This case specifically checks Py_Initialize(Ex) still works
+ out, err = self.run_embedded_interpreter("test_repeated_simple_init")
+ self.assertEqual(out, 'Finalized\n' * INIT_LOOPS)
+
def test_quickened_static_code_gets_unquickened_at_Py_FINALIZE(self):
# https://github.com/python/cpython/issues/92031