If I want to get a PyObject
for something like, say, sys.exc_info
, I can write
PyObject *sys_module = PyImport_Import("sys");
PyObject *sys_exc_info = PyObject_GetAttr(sys_module, "exc_info");
What if I want to get a PyObject
corresponding to a builtin such as list()
or dir()
? I've tried writing PyImport_Import("builtins")
and PyImport_AddModule("builtins")
and looking in the dictionary for that module, but it doesn't seem to be working as expected.