Mercurial > pytave
comparison oct-py-util.cc @ 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 | 1470ed26917a |
children | 0e4097c66788 |
comparison
equal
deleted
inserted
replaced
371:55cd61fe519a | 372:b20b8cf8ad07 |
---|---|
34 #include <boost/python.hpp> | 34 #include <boost/python.hpp> |
35 | 35 |
36 namespace pytave | 36 namespace pytave |
37 { | 37 { |
38 | 38 |
39 inline std::string | |
40 py_builtins_module_name () | |
41 { | |
42 #if PY_VERSION_HEX >= 0x03000000 | |
43 return "builtins"; | |
44 #else | |
45 return "__builtin__"; | |
46 #endif | |
47 } | |
48 | |
39 PyObject * | 49 PyObject * |
40 py_builtins_module () | 50 py_builtins_module () |
41 { | 51 { |
42 #if PY_VERSION_HEX >= 0x03000000 | 52 return py_import_module (py_builtins_module_name ()); |
43 return py_import_module ("builtins"); | |
44 #else | |
45 return py_import_module ("__builtin__"); | |
46 #endif | |
47 } | 53 } |
48 | 54 |
49 PyObject * | 55 PyObject * |
50 py_find_function (PyObject *module, const std::string& name) | 56 py_find_function (PyObject *module, const std::string& name) |
51 { | 57 { |