File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,16 +58,6 @@ void eval_test()
5858
5959void exec_test ()
6060{
61- // Register the module with the interpreter
62- if (PyImport_AppendInittab (const_cast <char *>(" embedded_hello" ),
63- #if PY_VERSION_HEX >= 0x03000000
64- PyInit_embedded_hello
65- #else
66- initembedded_hello
67- #endif
68- ) == -1 )
69- throw std::runtime_error (" Failed to add embedded_hello to the interpreter's "
70- " builtin modules" );
7161 // Retrieve the main module
7262 python::object main = python::import (" __main__" );
7363
@@ -152,6 +142,20 @@ int main(int argc, char **argv)
152142{
153143 BOOST_TEST (argc == 2 || argc == 3 );
154144 std::string script = argv[1 ];
145+
146+ // Register the module with the interpreter
147+ if (PyImport_AppendInittab (const_cast <char *>(" embedded_hello" ),
148+ #if PY_VERSION_HEX >= 0x03000000
149+ PyInit_embedded_hello
150+ #else
151+ initembedded_hello
152+ #endif
153+ ) == -1 )
154+ {
155+ BOOST_ERROR (" Failed to add embedded_hello to the interpreter's "
156+ " builtin modules" );
157+ }
158+
155159 // Initialize the interpreter
156160 Py_Initialize ();
157161
You can’t perform that action at this time.
0 commit comments