diff pyexec.cc @ 226:382bb1d91239

maint: import standard Python names consistently * pycall.cc, pyeval.cc, pyexec.cc: Import the builtins and main namespaces consistently.
author Mike Miller <mtmiller@octave.org>
date Wed, 20 Jul 2016 11:39:23 -0700
parents 28dc607532c2
children c02f0a4c92e7
line wrap: on
line diff
--- a/pyexec.cc	Wed Jul 20 11:12:36 2016 -0700
+++ b/pyexec.cc	Wed Jul 20 11:39:23 2016 -0700
@@ -66,11 +66,11 @@
 
   Py_Initialize ();
 
+  object main_module = import ("__main__");
+  object main_namespace = main_module.attr ("__dict__");
+
   try
     {
-      object main_module = import ("__main__");
-      object main_namespace = main_module.attr ("__dict__");
-
       // FIXME: figure out exec return code:
       // http://www.boost.org/doc/libs/1_38_0/libs/python/doc/v2/exec.html
       exec (code.c_str (), main_namespace, main_namespace);