Skip to content

Commit 70ee460

Browse files
committed
Py_Initialize outside the first test routine
[SVN r29167]
1 parent 07c95ae commit 70ee460

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/embedding.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ void test()
6363
if (PyImport_AppendInittab("embedded_hello", initembedded_hello) == -1)
6464
throw std::runtime_error("Failed to add embedded_hello to the interpreter's "
6565
"builtin modules");
66-
67-
// Initialize the interpreter
68-
Py_Initialize();
69-
7066
// Retrieve the main module
7167
python::object main_module((
7268
python::handle<>(python::borrowed(PyImport_AddModule("__main__")))));
@@ -169,6 +165,9 @@ test_tutorial2()
169165

170166
int main()
171167
{
168+
// Initialize the interpreter
169+
Py_Initialize();
170+
172171
if (python::handle_exception(test))
173172
{
174173
if (PyErr_Occurred())
@@ -190,6 +189,8 @@ int main()
190189
return 1;
191190
}
192191

192+
// Boost.Python doesn't support Py_Finalize yet.
193+
// Py_Finalize();
193194
return 0;
194195
}
195196
#include "module_tail.cpp"

0 commit comments

Comments
 (0)