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.
(cherry picked from commit 209abf746985526bce255e2fba97d3246924885d)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index c52cb99..f3b6043 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -229,6 +229,15 @@
self.assertEqual(out, '')
self.assertEqual(err, '')
+ def test_initialize_twice(self):
+ """
+ bpo-33932: Calling Py_Initialize() twice should do nothing (and not
+ crash!).
+ """
+ out, err = self.run_embedded_interpreter("initialize_twice")
+ self.assertEqual(out, '')
+ self.assertEqual(err, '')
+
if __name__ == "__main__":
unittest.main()