From 05e48865be69e1e5824f6915b588ff054717bb42 Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Sun, 30 Oct 2022 22:01:30 +1000 Subject: 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) --- Python/pylifecycle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Python/pylifecycle.c') diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 334abfb191..d26ae74a0f 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1313,6 +1313,7 @@ Py_InitializeEx(int install_sigs) config.install_signal_handlers = install_sigs; status = Py_InitializeFromConfig(&config); + PyConfig_Clear(&config); if (_PyStatus_EXCEPTION(status)) { Py_ExitStatusException(status); } -- cgit v1.2.1