bpo-33932: Calling Py_Initialize() twice does nothing (GH-7845) · python/cpython@209abf7

Original file line numberDiff line numberDiff line change

@@ -263,6 +263,19 @@ static int test_bpo20891(void)

263263

return 0;

264264

}

265265
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+
266279
267280

/* *********************************************************

268281

* List of test cases and the function that implements it.

@@ -288,6 +301,7 @@ static struct TestCase TestCases[] = {

288301

{ "pre_initialization_api", test_pre_initialization_api },

289302

{ "pre_initialization_sys_options", test_pre_initialization_sys_options },

290303

{ "bpo20891", test_bpo20891 },

304+

{ "initialize_twice", test_initialize_twice },

291305

{ NULL, NULL }

292306

};

293307