bpo-33932: Calling Py_Initialize() twice does nothing (GH-7845) · python/cpython@b940921 (original) (raw)

Original file line number Diff line number Diff line change
@@ -263,6 +263,19 @@ static int test_bpo20891(void)
263 263 return 0;
264 264 }
265 265
266 +static int test_initialize_twice(void)
267 +{
268 +_testembed_Py_Initialize();
269 +
270 +/* bpo-33932: Calling Py_Initialize() twice should do nothing
271 + * (and not crash!). */
272 +Py_Initialize();
273 +
274 +Py_Finalize();
275 +
276 +return 0;
277 +}
278 +
266 279
267 280 /* *********************************************************
268 281 * List of test cases and the function that implements it.
@@ -288,6 +301,7 @@ static struct TestCase TestCases[] = {
288 301 { "pre_initialization_api", test_pre_initialization_api },
289 302 { "pre_initialization_sys_options", test_pre_initialization_sys_options },
290 303 { "bpo20891", test_bpo20891 },
304 + { "initialize_twice", test_initialize_twice },
291 305 { NULL, NULL }
292 306 };
293 307