summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-09-30 12:53:17 +0200
committerGitHub <noreply@github.com>2019-09-30 12:53:17 +0200
commit81f6b031c46721478372d77fe2e55aa1f8300ae1 (patch)
tree38cebe6f4f301432f6e1a6f9edd7053fa0e005a4 /PC
parentbfca56b3ddb4bb0a98931ebcd1257af2afa9b2ae (diff)
downloadcpython-git-81f6b031c46721478372d77fe2e55aa1f8300ae1.tar.gz
bpo-38304: Fix PyConfig usage in python_uwp.cpp (GH-16488)
* Set PyPreConfig.struct_size and PyConfig.struct_size as required by the API. * PyPreConfig_InitPythonConfig() can now fail: check PyStatus result.
Diffstat (limited to 'PC')
-rw-r--r--PC/python_uwp.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/PC/python_uwp.cpp b/PC/python_uwp.cpp
index 06c1dd3536..2656d188c2 100644
--- a/PC/python_uwp.cpp
+++ b/PC/python_uwp.cpp
@@ -167,7 +167,10 @@ wmain(int argc, wchar_t **argv)
PyStatus status;
PyPreConfig preconfig;
+ preconfig.struct_size = sizeof(PyPreConfig);
+
PyConfig config;
+ config.struct_size = sizeof(PyConfig);
const wchar_t *moduleName = NULL;
const wchar_t *p = wcsrchr(argv[0], L'\\');
@@ -186,7 +189,10 @@ wmain(int argc, wchar_t **argv)
}
}
- PyPreConfig_InitPythonConfig(&preconfig);
+ status = PyPreConfig_InitPythonConfig(&preconfig);
+ if (PyStatus_Exception(status)) {
+ goto fail_without_config;
+ }
if (!moduleName) {
status = Py_PreInitializeFromArgs(&preconfig, argc, argv);
if (PyStatus_Exception(status)) {