# HG changeset patch # User Mike Miller # Date 1472245158 25200 # Node ID b20b8cf8ad07637bdd67110cbb87dc74c5b1471a # Parent 55cd61fe519a577b7cf7304b6a6d0613d89b005a 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. diff -r 55cd61fe519a -r b20b8cf8ad07 oct-py-util.cc --- 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 *