summaryrefslogtreecommitdiffstats
path: root/Programs
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-22 17:14:51 (GMT)
committerGitHub <noreply@github.com>2018-06-22 17:14:51 (GMT)
commit209abf746985526bce255e2fba97d3246924885d (patch)
tree4eaedaa7a870d61c2805df599e21fb9c883ddaeb /Programs
parentbcd3a1a18d841338f57c39f6a7de8cf14d0c3e03 (diff)
downloadcpython-209abf746985526bce255e2fba97d3246924885d.zip
cpython-209abf746985526bce255e2fba97d3246924885d.tar.gz
cpython-209abf746985526bce255e2fba97d3246924885d.tar.bz2
bpo-33932: Calling Py_Initialize() twice does nothing (GH-7845)
Calling Py_Initialize() twice does nothing, instead of failing with a fatal error: restore the Python 3.6 behaviour.
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_testembed.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 7406470..b8827f0 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -263,6 +263,19 @@ static int test_bpo20891(void)
return 0;
}
+static int test_initialize_twice(void)
+{
+ _testembed_Py_Initialize();
+
+ /* bpo-33932: Calling Py_Initialize() twice should do nothing
+ * (and not crash!). */
+ Py_Initialize();
+
+ Py_Finalize();
+
+ return 0;
+}
+
/* *********************************************************
* List of test cases and the function that implements it.
@@ -288,6 +301,7 @@ static struct TestCase TestCases[] = {
{ "pre_initialization_api", test_pre_initialization_api },
{ "pre_initialization_sys_options", test_pre_initialization_sys_options },
{ "bpo20891", test_bpo20891 },
+ { "initialize_twice", test_initialize_twice },
{ NULL, NULL }
};