mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
[3.11] gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98874)
* 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)
(cherry picked from commit 05e48865be
)
Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
This commit is contained in:
parent
5efe2eead3
commit
57dd11038f
5 changed files with 57 additions and 19 deletions
|
@ -1289,6 +1289,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue