changeset 372:b20b8cf8ad07

Make an internal function to return the name of the builtins module * oct-py-util.cc (pytave::py_builtins_module_name): New function. (pytave::py_builtins_module): Use it.
author Mike Miller <mtmiller@octave.org>
date Fri, 26 Aug 2016 13:59:18 -0700
parents 55cd61fe519a
children 0e4097c66788
files oct-py-util.cc
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/oct-py-util.cc	Fri Aug 26 10:57:08 2016 -0700
+++ b/oct-py-util.cc	Fri Aug 26 13:59:18 2016 -0700
@@ -36,14 +36,20 @@
 namespace pytave
 {
 
+inline std::string
+py_builtins_module_name ()
+{
+#if PY_VERSION_HEX >= 0x03000000
+  return "builtins";
+#else
+  return "__builtin__";
+#endif
+}
+
 PyObject *
 py_builtins_module ()
 {
-#if PY_VERSION_HEX >= 0x03000000
-  return py_import_module ("builtins");
-#else
-  return py_import_module ("__builtin__");
-#endif
+  return py_import_module (py_builtins_module_name ());
 }
 
 PyObject *